This is an old revision of the document!
⇐ Index
:Awake
is called whenever a unit with this script attached is created. This can happen at game load, or during a game when a unit is created with CreateUnit.
A critical distinction exists between scripts attached to units and scripts scheduled to run during Pre- or Post-phases of Global Control.
Functionally, the :Awake
function in pre- or Post Global Control phases are equivalent to a :Once
function. It is not executed until the appropriate moment in processing (before or after all units are processed for every game tick). This may cause execution of :Awake
functions to appear in the incorrect order, where each unit will execute it's :Awake“ function as it is instantiated during map load (either initial load or load from a save, there is no difference), and the
:Awake'' in a Global Control script will execute at the beginning or end, respectively, of a game tick.
:Awake SetUnitDebugText(self "I Live")