(uScript) HowTo : Create and Use Global Variables
Download the sample UnityProject and study the code here
Local vs. Global Variables
Some variables are “local” to a particular gameobject. Variables such as “health” or “max_speed” are common to many different gameobjects, from enemies to player avatars, and are thus considered “local”. Sometimes, however, we don’t want to tie variables down to a specific gameobject. These are called “Global Variables”, and they can be very powerful.
Global Variables make sense when only one “copy” of the variable is needed, such as a “score” variable, “lives” variable, etc.
Creating Global Variables
</h1>Using Global Variables</h1>
Play the game in your web browser here Download the UnityProject and study the code here