Пример #1
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Пример #2
0
 void Awake()
 {
     //Disable macots
     for (int i = 0; i < mascots.Count; ++i)
     {
         mascots[i].gameObject.SetActive(false);
     }
     for (int i = 0; i < randomPositions.Count; ++i)
     {
         randomPositions[i].gameObject.SetActive(false);
     }
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         DestroyImmediate(this.gameObject);
     }
 }