private void Awake()
 {
     if (instance)
     {
         DestroyImmediate(this.gameObject);
     }
     else
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
 }
Example #2
0
        private void Awake()
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                Destroy(this.gameObject);
                return;
            }

            DontDestroyOnLoad(this.gameObject);
        }
        private void Awake()
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                Destroy(this.gameObject);
                return;
            }

            DontDestroyOnLoad(this.gameObject);

            //PlayerPrefs.DeleteAll();
        }