Exemplo n.º 1
0
 //On Object Awake
 private void Awake()
 {
     //Check Singleton
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Exemplo n.º 2
0
 //On Object Destroy (Safeguard)
 public void OnDestroy()
 {
     instance = null;
 }