Documentation

Support

Unity Studio

Open Unity Studio

Unity Studio

New Variable window reference

A detailed description of each of the properties of the New Variable window.
Read time 1 minuteLast updated 18 days ago

Use the New Variable window to set up a new variable to use with your Logic script.

Property

Description

ScopeDecide how visible your variable is to other methods in your Logic:
  • 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.
Unique NameGive your variable a name that's easy to identify. Use descriptive names (for example,
Door_Anim
for a door's animation). Make sure the name doesn't contain spaces.
TypeChoose what kind of data your variable holds. For example, numbers, words, an object etc.
Default valueSet the initial value of your variable. This property only shows when you set Type to Bool, Float, Int, String, Vector3, or Vector2.

Type dropdown

The Type dropdown in the New Variable window includes the following options:

Option

Description

ObjectReference to a GameObject in your scene
BoolTrue/False (on/off)
FloatDecimal number
IntWhole number
StringText
Vector3/Vector2Position or direction in 3D/2D space
ColorColor value
TransformPosition, rotation, and scale info
ColliderBox, Capsule, Sphere, Mesh Collider
RigidbodyPhysics properties
Camera, Light, Material, UI Transform, Canvas, Button, Text, InputField, Animation, Image, Quaternion, Logic(Specialized references for UI and scene elements)

Additional resources