private void OnDestroy() { if (!_didDealDamage) { PlayerInfoScript info = PlayerInfoScript.instance; if (info) //If the PlayerInfoScript exists (ran game from main menu) add proper xp/coins { info.AddCoinsInLevel(_coins); info.AddXPInLevel(_xp); info.AddToTotalKills(); } else //For testing when running the game from this scene { Debug.Log("No PlayerInfoScript found!"); } } _sm.RemoveMonster(gameObject); }