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

    void MakeSingleton()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
    }//MakeSingleton