public void PlayerHasDied() { #if UNITY_ADS if (numberOfDeaths >= 9) { unityAds.ShowAd(); numberOfDeaths = 0; } else { numberOfDeaths++; } #endif watchedAd = false; menuManager.TurnCanvasOn(); menuManager.SetScoreAfterDeath(); PlayerPrefs.SetInt("lastScore", score); lastScoreText.text = lastScore.ToString(); highScore = PlayerPrefs.GetInt("highScore"); if (score > highScore) { PlayerPrefs.SetInt("highScore", score); bestScoreText.text = PlayerPrefs.GetInt("highScore").ToString(); facebookManager.SetScore(); } currentCoins = PlayerPrefs.GetInt("coins"); currentCoins += coins; PlayerPrefs.SetInt("coins", currentCoins); coins = 0; //Debug.Log(currentCoins); }