Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Awake() executed in a script that is deactivated

Discussion in 'Scripting' started by Tetsubo, Jan 17, 2017.

  1. Tetsubo

    Tetsubo

    Joined:
    Jun 26, 2014
    Posts:
    40
    Hello Unity Community,

    did I miss something in the Unity roadmap, which changed the default script behaviour, so that Awake() on an attached but deactivated script is still getting executed on start of scene? Is it just me or is it Unity 5.5?

    Could you please test and confirm? Thank you!
     
  2. Deleted User

    Deleted User

    Guest

    It seems to be the normal behaviour otherwise there would be no difference between Awake () and Start ():
    • Awake () is called if the script is attached to an active (enabled) object, even is the script is not enabled,
    • Start () is called if the script is attached to an active (enabled) object, if the script is enabled.
     
  3. Tetsubo

    Tetsubo

    Joined:
    Jun 26, 2014
    Posts:
    40
    Okay, good to know then. Thought that even awake() is not executed if component is deactivated.. thanks @AnneSchmidt