コード例 #1
0
 void CleanUpSingletonInstance()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
コード例 #2
0
 void EnsureSingletonInstance()
 {
     DontDestroyOnLoad(this);
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }