private void Awake() { if (nativeExpressAds) { DestroyImmediate(gameObject); } else { DontDestroyOnLoad(this.gameObject); nativeExpressAds = this; string id = (adID == null || adID == "" ? "ca-app-pub-6416530778400331/1695690401" : adID); adLoader = new AdLoader.Builder(id) .ForNativeAppInstallAd() .Build(); adLoader.OnNativeAppInstallAdLoaded += this.HandleNativeAppInstallAdLoaded; adLoader.OnAdFailedToLoad += this.HandleNativeAdFailedToLoad; RequestNativeAd(); Hide(); if (text != null) { text.text = "Awake"; } } }
public void Destroy() { Destroy(gameObject); if (iconObj != null) { Destroy(iconObj); } if (adChoicesObj != null) { Destroy(adChoicesObj); } if (headLineObj != null) { Destroy(headLineObj); } if (priceObj != null) { Destroy(priceObj); } if (storeObj != null) { Destroy(storeObj); } if (calToActionObj != null) { Destroy(calToActionObj); } nativeExpressAds = null; }