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