Skip to main content

Visual Script

Visual scripting lets you build game logic by connecting nodes in a graph, without writing code. It is designed for the kind of logic that sits between existing components: when the player walks into this trigger, open that door; when this lever is pulled, start that platform moving.

A visual script graph from the BrickBreaker sample: Update runs a Branch on the Paused variable, reads the Left and Right input states and moves the paddle with Set LocalPosition

If you are new to it, work through these in order:

  1. Your First Script — build a working script in about fifteen minutes.
  2. Entry Points and Events — how a script starts running.
  3. Key Nodes — the nodes you will use most, by task.
  4. Recipes — complete worked examples you can copy.

What it is good at​

Visual scripts are at their best as glue between systems. A trigger component reports that something entered an area; a spawn component can spawn a prefab. Connecting the two is a handful of nodes and no build step.

Typical uses:

  • Doors, levers, buttons, pressure plates and other interactables.
  • Moving platforms, lifts and patrol routes.
  • Reacting to gameplay events — a pickup collected, a checkpoint reached.
  • Sequencing timed behaviour with coroutines, such as "walk here, wait, then play this animation".
  • Prototyping a mechanic quickly to see whether it feels right.

Custom components​

The Visual Script Class Asset lets you write a custom component that interacts with other components in the same object hierarchy.

Custom state machine states​

The same asset can define a custom state machine state. The script then runs whenever that state is active.

Where the limits are​

Visual scripting exposes a deliberate subset of the engine. Some systems are not reachable from a script at all — resources and game states among them. Scripts are also harder to manage as they grow: a graph with a hundred nodes is more difficult to read and change than the equivalent code.

A good rule: if a script has grown past a screen or two, or you find yourself fighting the editor rather than the problem, it is time to move that logic into C++ or AngelScript. Prototype in visual script, ship whichever suits the final shape of the feature.

Performance​

Most visual script nodes call straight into existing C++ functions, dispatched by a small virtual machine. Execution is fast enough that it is rarely the reason to avoid a script — you are far more likely to hit the limits of editing a large graph than of running one.

See Also​

In this section​