Only when starting the game is calling interstitial. How do I get the Interstitial show in all three games? what should I do? periodically I want to call but could not find. my basic code is below Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; public class Interstitial : MonoBehaviour { InterstitialAd interstitial; // Use this for initialization void Start() { #if UNITY_ANDROID string appId = "Admob ID"; #elif UNITY_IPHONE string appId = "ca-app-pub-3940256099942544~1458002511"; #else string appId = "unexpected_platform"; #endif // Initialize the Google Mobile Ads SDK. MobileAds.Initialize(appId); #if UNITY_ANDROID string adUnitId = "ca-app-pub-3940256099942544/1033173712"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-3940256099942544/4411468910"; #else string adUnitId = "unexpected_platform"; #endif // Initialize an InterstitialAd. this.interstitial = new InterstitialAd(adUnitId); // Create an empty ad request. AdRequest request = new AdRequest.Builder() .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b") .Build(); // Load the interstitial with the request. this.interstitial.LoadAd(request); } void Update() { if (this.interstitial.IsLoaded()) { this.interstitial.Show(); } } void OnDestroy() { interstitial.Destroy(); //Destroy }
With this code, you are trying to show an ad about 60 times a second in your Update method. Only call Show when you need it!
Sorry, I don't follow. You have Show working, only call it when you need to! Where in your game do you want ads to show? That is where you place your Show method. You mention "all three games", did you mean scenes? For starters as you are learning the platform, I might suggest putting a test button on your scene, and showing an ad in the click event for the button, and go from there.