Exemple #1
0
 private void Update()
 {
     if (SceneManager.GetActiveScene().buildIndex == 10 || SceneManager.GetActiveScene().buildIndex == 2)
     {
         manager = null;
         Destroy(this.gameObject);
     }
 }
Exemple #2
0
 void Awake()
 {
     if (manager == null)
     {
         manager = this;
     }
     else if (manager != this)
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }