A variable is a named container for a value. Action parameters accept variables or hard-coded values.
A variable has several advantages over a hard-coded value:
- It has a name that makes its value more meaningful (e.g., maxNumberOfLives instead of 99).
- The same variable can be used in multiple places. Hard-coded values have to be edited separately.
- A variable's value can change over time!
Variable Types
Float | Stores floating point numbers |
Stores integer/whole numbers | |
Stores true/false values | |
GameObject | Stores references to GameObjects |
Color | Stores Color values |
String | Stores text values |
Vector2 | Stores Vector2 values (x,y) |
Vector3 | Stores Vector3 values (x,y,z) |
Rect | Stores Rect values (x,y,width,height) |
Material | Stores references to Materials |
Texture | Stores references to Textures |
Sprite | Stores references to Sprites. |
Quaternion | Stores Quaternion values (used for rotations) |
Object | Stores references to UnityEngine.Objects |
Array | Stores a collection of values |
Enum | Stores an Enum value |
Workflow Tips:
- NEW: Define custom menu items for Object and Enum variables using a Variable Type Definition Asset.
- NEW: Actions can now auto-convert between variable types when selecting variables.
See Also: