DEV Community

KENTO⚽️XR Engineer😎
KENTO⚽️XR Engineer😎

Posted on

【Unity】Can you explain whether Awake or Start is called when a Gameobject is activated?

Four years have passed since I started to use Unity, but I have misunderstood about the title.

Basically, Awake and Start are UnityEvent Function called when a Gameobject is activated.

But, how about are the below situations?

A Gameobject is active, a component is disable.

In this case, only Awake is called.

Image description

A Gameobject is inactive, a component is enable.

In this case, nothing is called.
Image description

Switch a Gameobject in the order of active, inactive, and active.

In this case, Awake and Start are called only once.

Image description

If you want to call something when a Gameobject's active changes, you can use OnEnable which is UnityEvent Function.

Other Resources

Order of execution for event functions

Top comments (0)