New Variable window reference
A detailed description of each of the properties of the New Variable window.
Read time 1 minuteLast updated 2 days ago
Use the New Variable window to set up a new variable to use with your Logic script.
Property | Description |
---|---|
Scope | Decide how visible your variable is to other methods in your Logic. For more information, refer to Scope dropdown. |
Unique Name | Give your variable a name that's easy to identify. Use descriptive names (e.g., “Door_anim” for a door’s animation). |
Type | Choose what kind of data your variable holds. For example, numbers, words, an object etc. |
Default value | Set the initial value of your variable. This property only shows when you set Type to Bool, Float, Int, String, Vector3, or Vector2. |
Scope dropdown
Option | Description |
---|---|
Local | Only available inside a single method. Disappears when the method finishes. |
Global | Available throughout your Logic script as long as the GameObject exists. Default. |
Type dropdown
Option | Description |
---|---|
Object | Reference to a GameObject in your scene |
Bool | True/False (on/off) |
Float | Decimal number |
Int | Whole number |
String | Text |
Vector3/Vector2 | Position or direction in 3D/2D space |
Color | Color value |
Transform | Position, rotation, and scale info |
Collider | Box, Capsule, Sphere, Mesh Collider |
Rigidbody | Physics properties |
Camera, Light, Material, UI Transform, Canvas, Button, Text, InputField, Animation, Image, Quaternion, Logic | (Specialized references for UI and scene elements) |