Wiki

Case Status
Log In

Wiki

 
Home ยป Core Concepts»Variables
Index
Navigation
Community Wiki

Variables

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

Int

Stores integer/whole numbers

Bool

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

 

Tags:

Last modified on 2/12/2019 1:31 PM by User.

  • RSS Feed