Пример #1
0
 private void OnDestroy()
 {
     if (current == this)
     {
         current = null;
     }
 }
Пример #2
0
 private void Awake()
 {
     if (current && current != this)
     {
         Debug.LogError("PCG Main have to be singleton!");
         DestroyImmediate(gameObject);
     }
     current = this;
 }