Hi guys I am looking for someone who can help me with this problem: I have this code
private const string AD_UNIT_ID = "***********";
private const string INTERSTITIAL_ID = "**********";
private AdMobPlugin admob;
public bool hidden = true;
void Awake(){
DontDestroyOnLoad (this);
}
// Use this for initialization
void Start () {
admob = GetComponent ();
admob.CreateBanner (AD_UNIT_ID, AdMobPlugin.AdSize.SMART_BANNER, false, INTERSTITIAL_ID);
admob.RequestAd ();
admob.HideBanner ();
admob.RequestInterstitial ();
}
// Update is called once per frame
void Update () {
}
public void BannerS(){
admob.ShowBanner();
hidden = false;
}
public void OnEnable(){
AdMobPlugin.InterstitialLoaded += HandleInterstitialLoaded;
}
public void OnDisable(){
AdMobPlugin.InterstitialLoaded -= HandleInterstitialLoaded;
}
public void HandleInterstitialLoaded ()
{
admob.ShowInterstitial ();
}
public void OnIntClosed(){
AdMobPlugin.InterstitialClosed += OnAdClosed;
}
public void OnAdClosed(){
admob.RequestAd ();
}
So my question is: in my game the interstitial ad displays just once, how do I make interstitials show up when I tell them to? For example I have this IEnumerator which I call when something is pressed:
IEnumerator WaitForSecond(){
yield return new WaitForSeconds (0.8f);
GameObject.Find ("AdMobControl").GetComponent ().HandleInterstitialLoaded ();
Debug.Log("Intestitial Shown");
}
Thanks!
↧