Beispiel #1
0
 /// <summary>
 /// The object has been enabled.
 /// </summary>
 protected virtual void OnEnable()
 {
     // The object may have been enabled outside of the scene unloading.
     if (s_Instance == null)
     {
         s_Instance = this;
         SceneManager.sceneUnloaded -= SceneUnloaded;
     }
 }
Beispiel #2
0
 private static void DomainReset()
 {
     s_Instance = null;
 }
Beispiel #3
0
 /// <summary>
 /// Reset the initialized variable when the scene is no longer loaded.
 /// </summary>
 /// <param name="scene">The scene that was unloaded.</param>
 private void SceneUnloaded(Scene scene)
 {
     s_Instance = null;
     SceneManager.sceneUnloaded -= SceneUnloaded;
 }