Beispiel #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         return;
     }
     Destroy(gameObject);
 }
Beispiel #2
0
    void MakeSingleton()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }

        instance = this;
        DontDestroyOnLoad(gameObject);
    }
 void Awake()
 {
     if (i == null)
     {
         i = this;
         DontDestroyOnLoad(gameObject);
     } else
     {
         Destroy(gameObject);
     }
 }
Beispiel #4
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        else
        {
            instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
    }