private IEnumerator LoadCoroutine() { yield return(new WaitUntil(() => GameObject.FindObjectsOfType <EventManager>() != null)); eventManagers = GameObject.FindObjectsOfType <EventManager>(); pauseController = GameObject.FindObjectOfType <PauseController>(); onPausePressed += Pause; BetterFPFC.Load(); }
private void OnDestroy() { SaveCameraState(); GameObject.Destroy(camera); Camera oldMainCamera = GameObject.Find("MainCamera").GetComponent <Camera>(); oldMainCamera.enabled = true; Logger.log?.Debug($"{name}: OnDestroy()"); instance = null; }
private void Awake() { if (instance != null) { Logger.log?.Warn($"Instance of {this.GetType().Name} already exists, destroying."); GameObject.DestroyImmediate(this); return; } GameObject.DontDestroyOnLoad(this); instance = this; Logger.log?.Debug($"{name}: Awake()"); }