Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

When are assemblies reloaded in between state changed of PlayModeStateChange?

Discussion in 'Documentation' started by Xarbrough, Dec 1, 2020.

  1. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    The EditorApplication.playModeStateChanged event reports the PlayModeStateChange enum. The latter doc page also describes when these state changes happen.

    But when are assemblies reloaded in regards to the events?

    For example, if I change a static variable in ExitingEditMode, I believe it will no longer be valid in EnteredPlayMode, because the assemblies are reloaded in between (maybe even depending on the user's editor setting). However, when exiting play mode, assemblies are not reloaded at all (as far as I know). So that would be something to clearly define here in the documentation.

    Also, in what order are the events if I start the play mode in a paused state? (I can select pause before entering play mode, so the first frame is executed, but not sure).