コード例 #1
0
 private void OnDestroy()
 {
     if (_instance == this)
     {
         _shuttingDown = true;
         _instance     = null;
     }
 }
コード例 #2
0
 void Awake()
 {
     if (_instance != null)
     {
         Debug.LogWarning("Duplicate ExperimentManager!", this.gameObject);
         DestroyImmediate(this);
         return;
     }
     DontDestroyOnLoad(this);
     _instance = this;
 }