Events and Logic

Use event nodes to respond to scene interactions and build conditional logic with branching and loops.

Events and Logic

Event Nodes

Every visual script starts with an Event node — a node that fires when something happens. The execution flow begins at the event and flows through connected nodes.

Scene Events

EventWhen it fires
On Scene ReadyScene has fully loaded — use for initialization
On UpdateEvery frame (use sparingly for performance)
On TimerAfter a specified delay (can repeat)
On Custom EventWhen another script calls Trigger Event with a matching name

Object Events

EventWhen it fires
On ClickViewer clicks or taps the object
On Hover EnterCursor or controller enters the object's hover area
On Hover ExitCursor or controller leaves the hover area
On DragObject is being dragged (if drag is enabled)
On Collision EnterPhysics collision starts
On Collision ExitPhysics collision ends
On Trigger EnterObject enters a trigger volume
On Trigger ExitObject leaves a trigger volume
On Animation EndAn animation clip finishes playing
On Visibility ChangeObject becomes visible or hidden

Input Events

EventWhen it fires
On Key DownA keyboard key is pressed
On Key UpA keyboard key is released
On Pointer DownMouse button or touch starts
On Pointer UpMouse button or touch ends

Logic Nodes

If / Else

The If node takes a Boolean input and routes execution down one of two paths:

[Condition] ──▶ [If]──▶ True branch
                    └──▶ False branch

Branch (Switch)

The Switch node routes execution based on which value matches among multiple cases — useful for menu navigation or multi-state objects:

[Value] ──▶ [Switch]──▶ Case "door": open door
                    ├──▶ Case "light": toggle light
                    └──▶ Default: do nothing

Compare

Produces a Boolean:

NodeOutput
Equalstrue if A == B
Not Equalstrue if A != B
Greater Thantrue if A > B
Less Thantrue if A < B

Boolean Logic

NodeOutput
Andtrue if both inputs are true
Ortrue if either input is true
NotInverts the boolean

Delay

Pauses execution for a specified number of seconds, then continues:

[On Click] ──▶ [Hide Object] ──▶ [Delay: 2s] ──▶ [Destroy Object]

Sequence

Runs multiple execution branches one after another from a single input — useful to trigger several actions from one event without chaining them linearly.

For Each

Iterates over a list of objects (e.g., all children of a parent object):

[Get Children] ──▶ [For Each] ──▶ [Set Color]
                         │
                         └──▶ (fires once per child)

Custom Events

Custom Events let you decouple scripts across different objects:

Trigger side (emitter object):

  • Use the Trigger Event node
  • Set the event name (e.g., "game-over")
  • Optionally attach a data payload

Listener side (any object in the scene):

  • Use the On Custom Event node
  • Set the same event name — it fires when any emitter triggers it

This pattern lets one object's script communicate with many other objects without direct connections between their graphs.

Practical Example: Door Toggle

[On Click]
   └──▶ [Get Variable: isOpen]
              └──▶ [If]
                    ├──▶ True ──▶ [Play Clip: "close"] ──▶ [Set Variable: isOpen = false]
                    └──▶ False ──▶ [Play Clip: "open"] ──▶ [Set Variable: isOpen = true]

This script lives on the door object. When clicked, it checks a boolean variable to decide whether to open or close the door.