Example #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         return;
     }
     Destroy(gameObject);
 }
Example #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);
     }
 }
Example #4
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

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