Quantcast
Channel: Questions in topic: "ads"
Viewing all articles
Browse latest Browse all 1416

My admob interstitial ads only shows once

$
0
0
I have ad script attached to the scene where I want to display the ad (game over part) so when I display the ad it only shows once, when i play the game again the ad doesn't appear at the game over part. void OnEnabled () { RequestInterstitial (); ShowInterstitial (); } void Update () { if (shown == false) { ShowInterstitial(); Debug.Log ("Not yet..."); } } private void RequestInterstitial() { //interstitial.Destroy (); //#if UNITY_ANDROID string adUnitId = "ca-app-pub-xxxxxxxxxxxxxxx/xxxxxxxxxx"; //#elif UNITY_IPHONE //string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE"; //#else //string adUnitId = "unexpected_platform"; //#endif // Initialize an InterstitialAd. interstitial = new InterstitialAd(adUnitId); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the interstitial with the request. interstitial.LoadAd(request); } private void ShowInterstitial() { if (interstitial.IsLoaded()) { interstitial.Show(); interstitial.Destroy (); shown = true; } else { Debug.Log ("Interstitial is not ready yet."); } } } Nothing fancy I'm using the simple code for interstitial ads

Viewing all articles
Browse latest Browse all 1416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>