Exemplo n.º 1
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Exemplo n.º 2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(transform.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
 // Use this for initialization
 void Awake()
 {
     if (!instance)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }