Skip to main content

Node Types Overview

This page provides an overview of the types of nodes available in the Scene Graph. Each node plays a specific role, from controlling flow and loading scenes to referencing variables and performing math operations. Understanding how these nodes work will help you design your Scene Graph.

Flow Control Nodes​

Flow Control nodes control how the flow progresses through the graph.

Start Node​

Image of Start Node

The Start node marks the beginning of the Scene Graph.

Image of grayed out Start Node in menu

There should be exactly one Start node per Scene Graph. If a Start node already exists, it is disabled (grayed out) in the Create Node menu.

Branch Node​

Image of Branch Node

The Branch node is a simple way to create decision-based flow from a single true/false condition. When executed, the Branch node reads the incoming Boolean value on its Condition pin and continues the flow through the True or False output. If nothing is connected to Condition, you can set its value directly with the checkbox on the node.

In this simple example, the branch checks the current state of a Boolean variable. If it is true, the flow proceeds to the "mountainview" scene. If it is false, the flow proceeds to the "survey" scene.

Image of the simple example

Switch Node​

Image of Switch Node

The Switch node routes the flow to one of several possible outputs. When executed, the node reads the value of its Selection string pin (either the attached string, or the text typed into the field when nothing is connected), compares it against the string value of each output pin, and sends the flow through the first pin with a matching label. If no match is found, the flow proceeds through the Default output. You can add or remove output pins with the + and - buttons.

note

If a matching output pin is not connected to anything, the flow does not fall back to Default; it reaches the end of the graph instead. Make sure every labeled output pin is connected.

In this simple example, there are four different trial orders (possible outputs) based on the counterbalancing design. The Switch checks the current value of the attached string variable. If the value matches one of the trial order values, the flow is routed accordingly and triggers the scene configured on that route.

Image of the simple example

End Node​

Image of End Node

The End node marks the termination point of a flow within the graph. End nodes aren't mandatory: if a flow reaches the end of a branch without an explicit End node, one is generated automatically at runtime.

Scene Nodes​

Image of Scene Node

The Scene node holds one of the individual scenes you've created (i.e., the individual pages).

info

Only scenes marked as Addressable in the Unity Editor can be assigned to a Scene node. Make sure each scene you want to use is marked as Addressable. For more details on working with Addressables, see Addressables.

When executed, the flow pauses and the specified scene loads. Once the user reaches the end of that scene, the flow resumes and continues until it reaches the next Scene node or the end of the graph.

Variable Reference Nodes​

Variables are properties that hold a value, such as a number or text, or point to something in your game, like a GameObject.

A Scriptable Variable is a special kind of global data asset. Unlike regular variables tied to objects in a scene, a Scriptable Variable stores data independently, so its value stays saved and accessible across different scenes or trials.

For example, the project includes a Scriptable Variable asset for the Subject ID, which keeps the ID consistent throughout the entire session.

Variable Reference nodes are container nodes that can hold a Scriptable Variable or a constant value. You can either assign a Scriptable Variable to the node to make its value accessible in the Scene Graph, or enter a fixed constant value directly in the node. To switch between a variable and a constant, use the dropdown on the node.

Image of variable reference dropdown

Variable Reference nodes are available in the following types:

Operator Nodes​

Operator nodes perform common math or logic operations in the Scene Graph. These nodes typically take two input values (on the left) and return a single result (on the right). The input values can come from other nodes (connected by data wires) or be entered directly in the node.

Operator nodes are found under Operator in the Create Node menu. The additive, multiplicative, relational, and equality operators take Float inputs; the logical operators take Boolean inputs. Because pins only connect to pins of exactly the same type, an Int or String value must go through a Cast Node before you can wire it into an operator.

Additive​

Multiplicative​

Division and modulus by 0 output NaN.

Relational​

Equality​

Logical​

Cast Node​

Connections between pins normally require matching data types. The Cast Node, however, lets you bridge different types by converting values from one type to another.

When you drag a wire from a data pin into the Cast Node’s input, the input type automatically adapts to match the connected pin.

Example of input pin adapting type

You can then select the desired output type (int, float, string, or bool) from the dropdown on the node. Changing the output type disconnects any existing output wires.

Example of output type changing via dropdown

Comment Box​

Comment boxes are containers for adding descriptive notes or annotations to a Scene Graph. They help organize your graphs and make them more readable and informative.

Image of Comment Box

To edit comment text:

  1. Right-click the comment box and choose Edit Comment from the context menu. An edit window appears.
  2. Enter your comment in the text area and click Apply.

Image of comment edit window

To resize the comment box, drag its lower-right corner.

Image of resizing comment

You can change the comment box's color with the Color field in the Inspector.

Image of inspector with color highlighted