//---------------------------------------------------------------------------------- // Methods ( Initialisation ) //---------------------------------------------------------------------------------- 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; m_CoinFormat = coinDisplay.text; Coins = 10; }
protected void OnApplicationQuit() { singletonInstance = null; }