Unity: Awake and Start

Adopt from

[1] http://unity3d.com/learn/tutorials/modules/beginner/scripting/awake-and-start

Both Awake() and Start() will be called once in the lifetime of a script on a GameObject even when you disable and re-enable the script.

The sequence of the function calls is difference. Awake() is invoked before Start().

Awake() is called when the script is loaded so it is a good place to set up the references between scripts and initialization. Start() will then be immediately called once the script component is enabled. Therefore, you can delay any part of initialization when it is really needed.


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *