Beispiel #1
0
 void OnDestroy()
 {
     if (_instance == this) {
         _instance = null;
         _instanceExists = false;
     }
 }
Beispiel #2
0
 void Awake()
 {
     if (_instance) {
         DestroyImmediate(this);
     }
     else {
         _instance = this;
         _instanceExists = true;
         _mainThread = Thread.CurrentThread;
     }
 }