- Home /
Question by
YuShaN308 · Feb 02, 2018 at 06:34 PM ·
adsadmobgoogle play
Interstitial Ads not display
Now I'm using Unity 5.5.5f1 and GoogleMobileAds 3.2.0 but when I call function showInterstitialAd() nothing happened. This is my source code.
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
public class ShowAdsManager : MonoBehaviour {
public string idAdMob = "";
public static ShowAdsManager instance = null;
InterstitialAd interstitial;
void Awake()
{
if (instance == null) {
instance = this;
}
else if (instance != this)
Destroy(gameObject);
DontDestroyOnLoad(gameObject);
}
// Use this for initialization
void Start () {
RequestInterstitialAds ();
}
private void RequestInterstitialAds()
{
interstitial = new InterstitialAd(idAdMob);
AdRequest request = new AdRequest.Builder().Build();
interstitial.OnAdClosed += Interstitial_OnAdClosed;
interstitial.LoadAd(request);
}
private void Interstitial_OnAdClosed(object sender, System.EventArgs e)
{
this.RequestInterstitialAds ();
}
public void showInterstitialAd() {
if (interstitial.IsLoaded()) {
interstitial.Show();
}
}
}
Comment