Ejemplo n.º 1
0
 void Awake()
 {
     if (inst == null)
     {
         inst = this;
     }
     else if (inst != this)
     {
         Destroy(gameObject);
         return;
     }
 }
Ejemplo n.º 2
0
 void Awake()
 {
     // If no Player ever existed, we are it.
     if (instance5 == null)
     {
         instance5 = this;
     }
     // If one already exist, it's because it came from another level.
     else if (instance5 != this)
     {
         Destroy(gameObject);
         return;
     }
 }