Пример #1
0
 void OnDestroy()
 {
     if (ins == this)
     {
         ins = null;
     }
     //do something clean up
     foreach (var p in GameObject.FindObjectsOfType <RemoveOnLevelChange>())
     {
         GameObject.DestroyImmediate(p.gameObject);
     }
     if (this.player != null)
     {
         GameObject.DestroyImmediate(this.player);
         this.player = null;
     }
 }
Пример #2
0
 void Awake()
 {
     ins = this;
 }