Init(args)
Scripting Reference
Loading...
Searching...
No Matches

◆ OnAwake()

virtual void Sisus.Init.StateMachineBehaviour< TFirstArgument, TSecondArgument >.OnAwake ( )
protectedvirtual

OnAwake is called when the script instance is being loaded during the Awake event after the Init method has finished. This happens as the game is launched and is similar to MonoBehavior.Awake.

Use OnAwake to initialize variables or states before the application starts.

Unity calls OnAwake only once during the lifetime of the script instance. A script's lifetime lasts until it is manually destroyed using UnityEngine.Object.Destroy.

OnAwake is always called before any Start functions. This allows you to order initialization of scripts. OnAwake can not act as a coroutine.

Note: Use OnAwake instead of the constructor for initialization, as the serialized state of the StateMachineBehaviour is undefined at construction time.