Version: 2019.4
Scene Reloading
Решение проблем в редакторе

The details of entering Play Mode

With Scene Reloading and Domain Reloading enabled, this is the full list of all processes and events that Unity performs when entering Play Mode:

  1. The AssemblyReloadEvent beforeAssemblyReload event is raised.
  2. The C# domain is stopped:
    a. OnDisable() is called for all ScriptableObjects and MonoBehaviours.
    b. Unity waits for all async operations to finish.
  3. The state of all MonoBehaviours and ScriptableObjects is serialized.
    a. OnBeforeSerialize() is called.
    b. All public and private field values are serialized, except those marked with [NonSerialized].
  4. Managed wrappers are disconnected from native Unity objects.
  5. The Unity Child Domain is reloaded:
    a. Mono domain unload:
    i. The AppDomain.DomainUnload event is raised.
    ii. The Unity Child Domain is destroyed
    1. GC and finalizers are called.
    2. Threads are terminated.
    3. All JIT info is deleted.
    b. The new Unity Child Domain is created.
  6. The assemblies are loaded:
    a. System assemblies are loaded.
    b. Unity assemblies are loaded.
    c. User assemblies are loaded.
  7. The synchronization context is initialized.
  8. The scripting state is restored.
    a. The scriptable part of all Unity objects is recreated.
    i. Constructors are called, and statics are assigned their default values.
    b. The state of all Unity objects is deserialized:
    i. The serialized stated of all Unity objects are restored.
    1. The OnAfterDeserialize event is raised.
    ii. OnValidate() is called.
    iii. For scripts using the [ExecuteInEditMode] attribute:
    1. OnEnable() is called.
    2. OnDisable() is called.
    3. OnDestroy() is called.
  9. Methods with the InitializeOnLoad and InitializeOnLoadMethod are called.
  10. The AssemblyReloadEvent afterAssemblyReload is called.

Scene Reloading
Решение проблем в редакторе
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961