protected void OnApplicationQuit() { singletonInstance = null; }
void Awake() { if( singletonInstance != null && singletonInstance != this ) { #if UNITY_EDITOR Debug.LogWarning("Singleton instance already exists within the scene. Destroying self but leaving the gameObject intact : " + this.gameObject.name ); #endif Destroy( this ); } else singletonInstance = this; }