Skip to main content

Variables and Properties

Two different things that both look like "storing a value":

  • Variables belong to the script. Declare them in the script's properties panel, and they persist between runs of the graph.
  • Properties belong to components. These nodes read and write settings on any component in the scene — the same values you edit in the inspector.

Script variables​

Declare variables first: deselect every node so the script's own properties appear, then add entries. Tick Expose on a variable to turn it into an exposed parameter, editable per instance wherever the script is used.

NodeTitleExecutionData inData out
GetVariableGet {Name}none—Value — Any
SetVariableSet {Name} = {Value}in, outValue — AnyValue — Any
IncVariable++ {Name}in, out—Value — Any
DecVariable-- {Name}in, out—Value — Any
TempVariable—in, outValue — AnyValue — Any

All of them take a Name property selecting which variable to act on. The type is worked out from the variable's declaration.

GetVariable has no execution pins. It is read whenever a running node asks for its value, which means you can place one anywhere and wire it to as many inputs as you like.

SetVariable outputs the value it just wrote, so you can chain it into the next node instead of adding a separate Get.

IncVariable / DecVariable add or subtract one. Useful for counters — collecting pickups, counting down lives.

TempVariable holds a value for the duration of one run of the graph, without declaring anything on the script. Reach for it when you need to reuse a computed value a few times and do not want it to persist.

Component properties​

These are the nodes for reading and writing any property the inspector shows.

GetProperty​

TitleGet {Property}
Executionnone
Data inObject — Any, required
Data outValue — Any
PropertiesType, Property

SetProperty​

TitleSet {Property} = {Value}
Executionin, out
Data inObject — Any, required; Value — Any
PropertiesType, Property, Value

Both pick their target type and property name in the property grid rather than through pins, which is how the node knows what kind of value to expect. The Object input takes the component to act on — usually from TryGetComponentOfBaseType.

The palette also generates dedicated Get<PropertyName> and Set<PropertyName> nodes per component type, which are easier to find when you already know the component you want.

tip

The interaction feedback recipe is the smallest complete example of this pattern: find a component, set one of its properties.

See Also​