void TestSingleton()
 {
     if (instance != null)
     {
         Destroy(gameObject); return;
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 2
0
 void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
 }