public static GameSingletonManagers Get() { if (Instance == null) { Instance = new GameSingletonManagers(); } return(Instance); }
public static T Get() { if (Instance == null) { Instance = new T(); GameSingletonManagers.Get().OnGameSingletonCreated(Instance); } return(Instance); }
public void OnDestroy() { for (var i = this.AllGameSingletons.Count - 1; i >= 0; i--) { var gameSingleton = this.AllGameSingletons[i]; if (gameSingleton != null) { gameSingleton.OnDestroy(); } } Instance = null; }
public void OnDestroy() { for (var i = this.AllGameSingletons.Count - 1; i >= 0; i--) { var gameSingleton = this.AllGameSingletons[i]; if (gameSingleton != null) { /// First calling the destroy callback gameSingleton.OnDestroy(); /// Unreferencing the singleton instance so that a new one is created on load gameSingleton.ClearInstance(); } } Instance = null; }