Beispiel #1
0
        private void Awake()
        {
            if (_instance == null)
            {
                _instance = this;
            }
            else if (_instance != this)
            {
                Destroy(this.gameObject);
                return;
            }

            DontDestroyOnLoad(this.gameObject);
        }
Beispiel #2
0
 private void OnDestroy()
 {
     _instance = null;
     SceneManager.sceneLoaded -= this.SceneManager_SceneLoaded;
 }