Question by
owlstreams · Jun 13, 2016 at 12:22 PM ·
admob
I wanted to set the admob interstitial ad to be viewed at the start points of the scene.
I wanted to set the admob interstitial ad to be viewed at the start points of the scenes. but it appears during the game play. how can I make it appear once in each scene when it starts?
using UnityEngine; using System.Collections; using admob;
public class adinter : MonoBehaviour {
// Use this for initialization
void Start ()
{
Admob.Instance().interstitialEventHandler += onInterstitialEvent;
Admob ad = Admob.Instance();
//ad.setTesting(true);
ad.initAdmob("ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxxx", "ca-app-pub-xxxxxxxxxxxxxxx/xxxxxxx");
if (ad.isInterstitialReady())
{
ad.showInterstitial();
}
else
{
ad.loadInterstitial();
}
}
void onInterstitialEvent(string eventName, string msg)
{
Debug.Log("handler onAdmobEvent---" + eventName + " " + msg);
if (eventName == AdmobEvent.onAdLoaded)
{
Admob.Instance().showInterstitial();
}
}
// Update is called once per frame
void Update () {
}
}
Comment