void Start()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(transform.gameObject);
     }
 }
Beispiel #2
0
 private void Awake()
 {
     if (Instance)
     {
         DestroyImmediate(gameObject);
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
 }
Beispiel #3
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }