protected void OnDestroy() { if (_instance != this) { return; } // Cleanup. OnMainEnd (); Instance = null; }
protected void Awake() { // Only allow single instance to exist. if (_instance != null && _instance != this) { Destroy (gameObject); return; } Instance = this; DontDestroyOnLoad (gameObject); // Invoke main. OnMainBegin (); }