Control flow
Use conditional branching, parallel execution, and loops in your behavior graphs.
Behavior graphs execute nodes sequentially by default - each node runs after the previous one finishes. Control Flow nodes let you execute nodes based on certain conditions, execute multiple nodes at once, and loop executions.
Conditional branching
The If node evaluates an expression and routes execution down one of two branches: True or False.
Only the matching branch executes; the other is skipped entirely.
Merging branches with End If
If you need to continue execution after both branches converge, use the End If node. Connect the end of each branch to its two inputs.
┌─ True → ... ─┐
Event → If End If → ...
└─ False → ... ─┘End If is optional — you only need it when you want to do something after the conditional regardless of which branch ran. Each branch can also simply end on its own without merging.
Important
An End If node must merge exactly two branches that originate from the same If node. The editor will reject graphs where an End If merges branches from a Split node or from two unrelated paths.
Parallel execution
The Split node forks execution into multiple parallel branches. All connected branches run concurrently.
┌─ Branch 1 → ... ─┐
Event → Split Sync → ...
└─ Branch 2 → ... ─┘Waiting for all branches with Sync
The Sync node is a barrier — execution pauses until all incoming branches have arrived, then continues.
Important
A Sync node must merge branches that originate from a Split node (or another node that produces parallel execution). Do not use Sync to merge branches from an If node — since only one If branch ever runs, Sync would wait forever for the other. Use End If instead.
Looping
The Repeat Until node creates a loop. By
default, it runs the loop body at least once, then evaluates an expression
after each iteration to decide whether to continue. When
checkConditionBeforeRunning is enabled, it evaluates the condition before
executing the first iteration. While it is true, the loop repeats. When it
becomes false, execution exits through the next output.
Ports
The Repeat Until node has two inputs and two outputs:
| Port | Direction | Purpose |
|---|---|---|
previous | Input | Entry point for the loop node itself. |
loopEnd | Input | Where the loop body connects back. |
loopStart | Output | Where the loop body begins. |
next | Output | Continues after the loop exits. |
┌──────────────────────────┐
↓ │
Event → Repeat Until → (loopStart) → ... → (loopEnd)
│
└→ (next) → ...Loop isolation
Nodes inside a loop body cannot receive connections from outside the loop. For example, if node A is outside the loop and node B is inside the loop body, drawing an edge from A into B is invalid because B already has an input from the loop path. The engine will reject this graph with an error.
If you need external data inside a loop, set it to a variable
before the loop starts and read it with $variables inside.