void OnBecameInvisible() { if (PlayerPrefs.HasKey("GamesPlayed")) { PlayerPrefs.SetInt("GamesPlayed", PlayerPrefs.GetInt("GamesPlayed") + 1); if (PlayerPrefs.GetInt("GamesPlayed") % 4 == 0) { if (adMan != null) { adMan.ShowAd(); AnalyticsManager.WatchedAd(); } } } else { PlayerPrefs.SetInt("GamesPlayed", 1); } this.GetComponent <Leaderboard>().AddMultiplier(highestMultiplier); AnalyticsManager.FinishedGame(score); }