Global

From ETC Public Wiki
Jump to: navigation, search

Global variables can be defined in any script and then will be availible to all scripts within the game.

Create a script named globalData

 static var state : String;
 
 function Awake () {
   state = "standby";
 }

Then in another script you will be able to access it via the script name

 function Start () {
   print ( globalData.state );
   globalData.state = "play";
 }