public void ChangePublishing() { ads.publishing = !ads.publishing; if (ads.publishing) { PublishingOrNot.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Real Ads"; } else { PublishingOrNot.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Test Ads"; } Reset(); }
// Start is called before the first frame update void Start() { ads = GetComponent <GoogleAds>(); ads.AdsClosed += AdsClosedEvent; ads.AdsStarted += AdsOpenEvent; ads.AdsCompleteGiveReward += AdsRewardEvent; InterstitialAdsBtn.onClick.AddListener(() => ShowAds(AdsType.Interstitial)); RewarededAdsBtn.onClick.AddListener(() => ShowAds(AdsType.Rewarded)); PublishingOrNot.onClick.AddListener(ChangePublishing); if (ads.publishing) { PublishingOrNot.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Real Ads"; } else { PublishingOrNot.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Test Ads"; } UpdateDisplay(); }