private void Awake() { if (instance == null) { instance = this; } SceneManager.sceneLoaded -= OnSceneWasLoaded; SceneManager.sceneLoaded += OnSceneWasLoaded; }
private void OnApplicationQuit() { instance = null; Destroy(this.gameObject); applicationIsQuitting = true; }