unifiednativead is setting null using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; using System.Linq; using UnityEngine.UI; public class DisplaySquareGoogleBannerSelfPosNative : MonoBehaviour { private UnifiedNativeAd nativeAd; private bool unifiedNativeAdLoaded; unifiednativead is setting null How to use it? unifiednativead is setting null // Below are the UI element that you need to assign from Unity Editor public UITexture adChoiceTexture; public UITexture appIcon; public UILabel headlines; public GameObject starRating; public UILabel store; public UILabel bodyText; public Image bigImage; //public GameObject callToAction; unifiednativead is setting null How to get it? unifiednativead is setting null public UILabel buttonText; public Texture debugTexture; // Use this for initialization void Start() { Debug.Log("RequestNativeAd"); RequestNativeAd(); } unifiednativead is setting null How to dowload it? unifiednativead is setting null // Update is called once per frame void Update() { Debug.Log("this.unifiedNativeAdLoaded: " + this.unifiedNativeAdLoaded); if (this.unifiedNativeAdLoaded) { this.unifiedNativeAdLoaded = false; Texture2D adChoiceLogoTexture = this.nativeAd.GetAdChoicesLogoTexture(); if (adChoiceLogoTexture != null) unifiednativead is setting null How to get it? unifiednativead is setting null { adChoiceTexture.mainTexture = adChoiceLogoTexture; if (!this.nativeAd.RegisterAdChoicesLogoGameObject(adChoiceTexture.gameObject)) { Debug.Log("RegisterAdChoicesLogoGameObject Unsuccessfull"); } adChoiceTexture.gameObject.AddComponent(); adChoiceTexture.gameObject.GetComponent().isTrigger = true; } unifiednativead is setting null How to get it for free? unifiednativead is setting null Texture2D iconTexture = this.nativeAd.GetIconTexture(); if (iconTexture != null) { appIcon.mainTexture = iconTexture; if (!this.nativeAd.RegisterIconImageGameObject(appIcon.gameObject)) { Debug.Log("RegisterIconImageGameObject Unsuccessfull"); } appIcon.gameObject.AddComponent(); unifiednativead is setting null PasteShr unifiednativead is setting null appIcon.gameObject.GetComponent().isTrigger = true; } string headline = this.nativeAd.GetHeadlineText(); if (headline != null) { headlines.GetComponent().text = headline; if (!this.nativeAd.RegisterHeadlineTextGameObject(headlines.gameObject)) { Debug.Log("RegisterHeadlineTextGameObject Unsuccessfull"); unifiednativead is setting null How to use it? unifiednativead is setting null } headlines.gameObject.AddComponent(); headlines.gameObject.GetComponent().isTrigger = true; } string storeName = this.nativeAd.GetStore(); if (storeName != null) { store.text = storeName; if (!this.nativeAd.RegisterStoreGameObject(store.gameObject)) unifiednativead is setting null PasteShr unifiednativead is setting null { Debug.Log("RegisterStoreGameObject Unsuccessfull"); } } string bodyText = this.nativeAd.GetBodyText(); if (bodyText != null) { this.bodyText.GetComponent().text = bodyText; if (!this.nativeAd.RegisterBodyTextGameObject(this.bodyText.gameObject)) unifiednativead is setting null How to get it? unifiednativead is setting null { Debug.Log("RegisterBodyTextGameObject Unsuccessfull"); } this.bodyText.gameObject.SetActive(false); this.bodyText.gameObject.AddComponent(); this.bodyText.gameObject.GetComponent().isTrigger = true; } /*double starRating = this.nativeAd.GetStarRating(); unifiednativead is setting null How to use it? unifiednativead is setting null if (starRating != null && starRating >= 0) { if (starRating >= 0 && starRating < 2) { this.starRating.transform.GetChild(0).gameObject.SetActive(true); } else if (starRating > 1 && starRating < 3) { this.starRating.transform.GetChild(1).gameObject.SetActive(true); } else if (starRating > 2 && starRating < 4) { this.starRating.transform.GetChild(2).gameObject.SetActive(true); } else if (starRating > 3 && starRating < 5) { this.starRating.transform.GetChild(3).gameObject.SetActive(true); } else if (starRating > 4 && starRating < 6) { this.starRating.transform.GetChild(4).gameObject.SetActive(true); } } else { unifiednativead is setting null How to get it for free? unifiednativead is setting null this.starRating.SetActive(false); this.store.SetActive(false); this.bodyText.SetActive(true); }*/ if (this.nativeAd.GetImageTextures().Count > 0) { List goList = this.nativeAd.GetImageTextures(); bigImage.GetComponent().mainTexture = goList[0]; List list = new List(); unifiednativead is setting null How to get it? unifiednativead is setting null list.Add(bigImage.gameObject); this.nativeAd.RegisterImageGameObjects(list); this.bigImage.gameObject.AddComponent(); this.bigImage.gameObject.GetComponent().isTrigger = true; } string buttonTextString = this.nativeAd.GetCallToActionText(); /*if (buttonTextString != null) { buttonText.GetComponent().text = buttonTextString; unifiednativead is setting null PasteShr unifiednativead is setting null this.buttonText.AddComponent(); } if (!this.nativeAd.RegisterCallToActionGameObject(buttonText)) { Debug.Log("RegisterCallToActionGameObject Unsuccessfull"); }*/ Debug.Log("Headline is " + headline); Debug.Log("Advitiser Text is " + this.nativeAd.GetAdvertiserText()); unifiednativead is setting null How to dowload it? unifiednativead is setting null Debug.Log("GetBodyText is " + this.nativeAd.GetBodyText()); Debug.Log("GetCallToActionText is " + buttonTextString); Debug.Log("GetPrice is " + this.nativeAd.GetPrice()); Debug.Log("GetStarRating is " + starRating); Debug.Log("GetStore is " + storeName); } } unifiednativead is setting null PasteShr unifiednativead is setting null private void RequestNativeAd() { AdLoader adLoader = new AdLoader.Builder("ca-app-pub-9440908801504334/8446904807") .ForUnifiedNativeAd() .Build(); adLoader.OnUnifiedNativeAdLoaded += this.HandleUnifiedNativeAdLoaded; adLoader.OnAdFailedToLoad += this.HandleNativeAdFailedToLoad; adLoader.LoadAd(new AdRequest.Builder().Build()); } unifiednativead is setting null How to get it for free? unifiednativead is setting null private void HandleNativeAdFailedToLoad(object sender, AdFailedToLoadEventArgs args) { Debug.Log("Native ad failed to load: " + args.Message); } private void HandleUnifiedNativeAdLoaded(object sender, UnifiedNativeAdEventArgs args) { Debug.Log("Unified Native Ad Loaded"); this.nativeAd = args.nativeAd; this.unifiedNativeAdLoaded = true; unifiednativead is setting null PasteShr unifiednativead is setting null } } unifiednativead is setting null