- Home /
Question by
Arcticstar · Aug 11, 2017 at 11:42 AM ·
unity 5script.adsadmob
Ads shows in the editor but not in the Game? please help.
when I debug it in the editor it gives me all the messages for showing and building ADs but when loading the game nothing shows.
here is the script for the adbanner
using GoogleMobileAds.Api; using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Ads : MonoBehaviour {
BannerView bannerAd;
void Start () {
showBannerAd();
}
private void showBannerAd()
{
string adID = "ca-app-pub-3940256099942544/1033173712";
//***For Testing in the Device***
AdRequest request = new AdRequest.Builder()
.AddTestDevice(AdRequest.TestDeviceSimulator) // Simulator.
.AddTestDevice("2077ef9a63d2b398840261c8221a0c9b") // My test device.
.Build();
//***For Production When Submit App***
//AdRequest request = new AdRequest.Builder().Build();
bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top);
bannerAd.LoadAd(request);
bannerAd.Show();
}
void OnDestroy() {
bannerAd.Destroy ();
}
}
I used this same code with different AD unit of course in my old game and it worked fine. but now it won't work. so is there any other reasons for this, maybe like it depends on the sdk and the plugin version?
Comment