void Awake() { if (_instance == null) { _instance = this; } #if UNITY_5_4_OR_NEWER SceneManager.sceneLoaded -= OnSceneWasLoaded; SceneManager.sceneLoaded += OnSceneWasLoaded; #endif }
void OnApplicationQuit() { _instance = null; Destroy(gameObject); _applicationIsQuitting = true; }