Search Issue Tracker

By Design



Found in


Issue ID




Awake & Start not called before Update when assembly is reloaded for ExecuteInEditMode scripts



To reproduce:
1. Open the attached project
2. Observe that "Awake", "Start", "Update" is displayed in the console (because of the ExecuteInEditMode script)
3. Reimport the script to trigger recompile
4. Move the camera around
5. Notice that "Update" is called without any calls to "Awake" and "Start"

Awake and Start are not called on the object because they were already called on this object upon its first creation. On load, the object state is serialized (public and private variables) and then deserialized. When deserialization happens, as long as the object already existed, Awake nor Start are not invoked.

This is by design, and it's tightly coupled in the MonoBehaviour lifecycle. Changing this behavior will possibly impact on all the projects that don't expect Awake/Start to be invoked.

Comments (11)

  1. D2e4ba46f6d6671f49eb77455318bd05?d=mm


    Jun 05, 2019 12:49

    This is 100% bug and this is a shame that it is not fixed yet

  2. F9679dc4b7c02176e5abd3071fa4ab03?d=mm


    Dec 03, 2018 01:20

    While I agree that this bug should be fixed, you can get around it pretty easily by relying on OnEnable and OnDisable for your needs.

    I've started to use Awake for Serialized Properties, and OnEnable and OnDisable for NonSerialized Properties.

    OnEnable and OnDisable are especially good for adding and removing listeners to other objects in Editor Mode.

  3. 8d6b0b2c25a96881308d17b6787f4459?d=mm


    Nov 04, 2017 12:46

    Why wontfix?

  4. D019f6bfae9710af100f3a9f025bcd0d?d=mm


    Oct 22, 2017 15:05

    +1 to know why not fix this!

  5. F4879764b380355e718e8f3813d3a66c?d=mm


    Aug 15, 2017 13:51

    It is a bug. Why it is Won't fix?

  6. Ec2dd7b451f8eafc3a152e3f65588725?d=mm


    Jul 30, 2017 09:30

    yes it's definitely an annoying bug, and goes against the documentation. Really pure attitude from the Unity Staff to flag it 'Won't Fix" without any explanation !

  7. 206b506388418b6ed625fb08f5392fc7?d=mm


    May 15, 2017 10:51

    I also encountered this bug just now. Why is this a won't fix?

  8. 037cd9b24367cc0757d8d8288a144059?d=mm


    Mar 24, 2017 18:25

    +1 to knowing why this ticket has been abandoned. Even a "this is not a priority for us" would be an acceptable answer.

    But for anyone else who lands on this, I was able to work around it by manually calling Start() again if things look amiss. e.g:

    void Update() {
    if (Application.isEditor && !Application.isPlaying && anyClassVarThatShouldntBeNull == null) {
    Start(); // Or whatever other method re-initializes your vars

  9. 9d2aebbeb191510450f6c56eff1f32e4?d=mm


    Mar 15, 2017 10:50

    +1 to knowing why this isn't a Won't Fix.

  10. 0c6fa2ab3501fff8a32cb914f1097dc4?d=mm


    Aug 20, 2016 14:44

    I would also like to know why this has been marked as Won't Fix?

    ExecuteInEdit mode allows objects to be initialized and updated via Awake/Start/Update, but saving a script breaks all the connections. This feature appears fundamentally broken if it only works until you make a change to a script.

    As for OnValidate - while this does get called after reloading scripts, it does not respect ScriptExecutionOrder, so it is not equivalent or suitable as a drop-in replacement for Awake/Start.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.