Inheritance: MonoBehaviour
Esempio n. 1
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
 // Use this for initialization
 void Start()
 {
     if (singleton != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         singleton = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }