Skip to content
Loom0.1.0
Source

Get started

Your first Blueprint

Grow the BP_Counter from Installing Loom into an actor that counts on screen, one idea at a time. Any Unreal project works, such as a new one from the Third Person template.

  1. An on block is an event: it runs when the engine calls it. ReceiveBeginPlay is Event BeginPlay. Add it, and print the count:

    Content/Counter/BP_Counter.lm
    blueprint BP_Counter : Actor at /Game/Counter/BP_Counter
    var Count: int = 0
    fn Bump() {
    Count = Count + 1
    }
    on ReceiveBeginPlay {
    Bump()
    KismetSystemLibrary.PrintString(string(Count))
    }

    Save. Drag BP_Counter from the Content Browser into the level, and press Play.

    You see1 in the top left of the game view.
  2. Call Bump every second with a timer, and move the print into it:

    Content/Counter/BP_Counter.lm
    blueprint BP_Counter : Actor at /Game/Counter/BP_Counter
    var Count: int = 0
    fn Bump() {
    Count = Count + 1
    KismetSystemLibrary.PrintString(string(Count))
    }
    on ReceiveBeginPlay {
    KismetSystemLibrary.K2_SetTimerDelegate(Bump, 1.0, true)
    }
    You seeThe count going up once a second.
  3. editable shows a variable in the Details panel, where each copy in the level can set its own value. The comment above it becomes its tooltip.

    Content/Counter/BP_Counter.lm
    blueprint BP_Counter : Actor at /Game/Counter/BP_Counter
    var Count: int = 0
    // Seconds between counts.
    editable var Every: float = 1.0
    fn Bump() {
    Count = Count + 1
    KismetSystemLibrary.PrintString(string(Count))
    }
    on ReceiveBeginPlay {
    KismetSystemLibrary.K2_SetTimerDelegate(Bump, Every, true)
    }

    Select BP_Counter in the level, set Every to 0.25, and press Play.

    You seeThe count going up four times a second.
  4. Change Count + 1 to Coutn + 1 and save.

    You seeA notification that the build failed. Its error is in the Message Log, under Loom: no variable Coutn, with the line and column.

    Fix the name and save again.

  5. Every Loom file in the project knows the others. This one nudges the counter every five seconds:

    Content/Counter/BP_Nudger.lm
    blueprint BP_Nudger : Actor at /Game/Counter/BP_Nudger
    editable var Counter: BP_Counter
    fn Nudge() {
    Counter.Bump()
    }
    on ReceiveBeginPlay {
    KismetSystemLibrary.K2_SetTimerDelegate(Nudge, 5.0, true)
    }

    Drag BP_Nudger into the level, set its Counter to the BP_Counter there, and press Play.

    You seeAn extra count every five seconds.

A variable, a function, an event, a timer from the engine, a setting in the Details panel, and one Blueprint using another. Coming from Blueprints gives the Loom for every other node you know.