IEnumerator WaitForCoins() { yield return(new WaitUntil(() => CoinsEarned != null)); if (CoinsEarned == true) { ScorePanel sp = GetComponent <ScorePanel>(); if (sp != null) { sp.ShowDoubleCoins(); } GameObject goShop = GameObject.Find("pnlShop(Clone)"); if (goShop != null) { goShop.GetComponent <ShopPanel>().AddCoins(CoinsReward); } UserDataManager.Instance.Data.Coins += CoinsReward; UserDataManager.Instance.SaveToFile(); } CoinsEarned = null; LoadAd(); yield return(0); }