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