Variables
State Machine and Runner Variables
State Machine 2 introduces two types of variables that integrate with Game Creator 2's visual scripting system.
All variables can be created from the State Machine Asset, State Machine Runner, or the Blackboard in the Graph Editor.
Shared state across all runners
Instance-level (per runner)
Unique state per GameObject
State Machine Variables
These variables are stored in the State Machine Asset itself. All runners using the same asset share these values.
State Machine Variables in the Blackboard Shared configuration values
Default values for all instances
Changes affect all runners using the asset
Values persist between play sessions (stored in asset)
Reset when asset is reimported
Be careful when modifying State Machine Variables during runtime - changes will affect all active runners.
State Machine Runner Variables
These variables are instance-specific. Each runner maintains its own copy with independent values.
Runner Variables in the Inspector Character-specific state (health, mana, ammo)
Individual object behavior
Per-instance configuration
Each runner has independent values
Values are initialized from the State Machine Asset
Changes don't affect other runners
Creating Variables
From the Blackboard
Click + in the Blackboard panel
From the Inspector
Select the State Machine Asset or Runner
Expand the Variables section
Configure the variable type and name
Supported Types
Reference to a GameObject
Reference to an Animation Clip
Reference to an Audio Clip
Using Variables in Nodes
Variables can be accessed directly in node properties:
Click on a property field
Select Variables → State Machine or Variables → Runner
Accessing Variables via Visual Scripting
Use the Properties system to read and write variables from any Game Creator 2 instruction or condition.
Network Synchronization
When using multiplayer modules (Fusion or Photon):
Select a variable in the Blackboard
The variable value syncs across all clients
Use Runner Variables for Gameplay
Most gameplay values should be Runner Variables:
Use Asset Variables for Defaults
Asset Variables work well for:
Initial values (copied to runners)
Name Consistently
Use clear, descriptive names: