Пример #1
0
 private void Awake()
 {
     if (!current)
     {
         current = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (current != this)
     {
         Destroy(gameObject);
     }
 }
Пример #2
0
 private void OnDestroy()
 {
     current = null;
 }