Pro_Unit

LoadingManager

Mar 7th, 2020
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. namespace GameCore
  2. {
  3.  
  4.     using UnityEngine.SceneManagement;
  5.  
  6.     public class LoadingManager : SingletonData<LoadingManager>
  7.     {
  8. #if UNITY_EDITOR
  9.         [UnityEditor.MenuItem ("Game/Data/LoadingManager")] public static void Select () { UnityEditor.Selection.activeObject = instance; }
  10.         public override void ResetDefault () { nextScene = "Menu"; }
  11.         public override void InitOnCreate () { }
  12. #else
  13.         public override void ResetDefault () { }
  14. #endif
  15.         public string nextScene = "Menu";
  16.         Scene activeScene => SceneManager.GetActiveScene ();
  17.         public void ReloadScene ()
  18.         {
  19.             SceneManager.LoadScene (activeScene.buildIndex);
  20.         }
  21.         public void LoadScene (string SceneName)
  22.         {
  23.             SceneManager.LoadScene (SceneName);
  24.         }
  25.     }
  26.  
  27. }
Add Comment
Please, Sign In to add comment