private void Awake() { if (instance != null) { Logger.log?.Warn($"Instance of {this.GetType().Name} already exists, destroying."); GameObject.DestroyImmediate(this); return; } GameObject.DontDestroyOnLoad(this); // Don't destroy this object on scene changes instance = this; Logger.log?.Debug($"{name}: Awake()"); }
public void OnMenuSceneLoadedFresh(ScenesTransitionSetupDataSO transitionSetupDataSO) { PP_HelperController.OnLoad(); if (!RawPPLoader.IsInit()) { RawPPLoader.Initialize(); } PPUtils.Initialize(); ProfileDataLoader.instance.Initialize(); AccLoader.instance.Initialize(); if (Config.playHistory) { PlayHistoryTracker.Initialize(); } }
private void OnDestroy() { Logger.log?.Debug($"{name}: OnDestroy()"); instance = null; // This MonoBehaviour is being destroyed, so set the static instance property to null. }