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

admob repeating infinit times can't stop

$
0
0
hi, i can't stop the ad interstitial showing up after first time, it continuos at infinity even in the debug it's going crazy, i'm trying to show up only on death of the player, it mean at "GAME OVER", but it doesn't stop at that. i want to show up only 3-4 times after death or maybe every 5 minutes using System.Collections; using UnityEngine; using GoogleMobileAds.Api; public class AdScript : MonoBehaviour { InterstitialAd interstitial; private void Start() { RequestInterstitial(); } void Update() { if (GameManager.isGameOver) { showInterstitialAd(); } } public void showInterstitialAd() { if (interstitial.IsLoaded()) { interstitial.Show(); } } private void RequestInterstitial() { #if UNITY_ANDROID string adUnitId = "ca-app-pub-3940256099942544/1033173712"; #elif UNITY_IOS string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE"; #else string adUnitId = unexpected_platform"; #endif interstitial = new InterstitialAd(adUnitId); interstitial.OnAdClosed += Interstitial_OnAdClosed; //AdRequest request = new AdRequest.Builder().Build(); AdRequest request = new AdRequest.Builder() .AddTestDevice(AdRequest.TestDeviceSimulator) .AddTestDevice(SystemInfo.deviceUniqueIdentifier) .Build(); interstitial.LoadAd(request); } private void Interstitial_OnAdClosed(object sender, System.EventArgs e) { RequestInterstitial(); }

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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