Пример #1
0
 //On Object Awake
 private void Awake()
 {
     //Check Singleton
     if (instance != null && instance != this)
     {
         Destroy(this);
     }
     else
     {
         instance = this;
     }
 }
Пример #2
0
 //On Object Destroy (Safeguard)
 public void OnDestroy()
 {
     instance = null;
 }