Hello everyone! Im trying to get the Interstitial Ad to show. It shows in the Editor but not in the Game Build. The banner as was to see if the others worked as well and it does. The Script for my ads is below. IF you guys need anything else let me know and ill find it.
Thanks.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using System;
using UnityEngine.SceneManagement;
public class AdMobScript : MonoBehaviour
{
string App_ID = "ca-app-pub-(Edited Out)";
string ScreenAd_ID = "ca-app-pub-(Edited Out)";
string testAdID = "ca-app-pub-(Edited Out)";
private BannerView bannerView;
private InterstitialAd interstitial;
private void RequestBanner()
{
// Create a 320x50 banner at the top of the screen.
this.bannerView = new BannerView(testAdID, AdSize.Banner, AdPosition.Top);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
this.bannerView.LoadAd(request);
}
private void Start()
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(initStatus => { });
this.RequestBanner();
}
public void RequestInterstitial()
{
if (interstitial != null)
{
interstitial.Destroy();
}
// Initialize an InterstitialAd.
this.interstitial = new InterstitialAd(ScreenAd_ID);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the interstitial with the request.
this.interstitial.LoadAd(request);
if (this.interstitial.IsLoaded())
{
this.interstitial.Show();
}
this.interstitial.OnAdClosed += HandleOnAdClosed;
}
public void HandleOnAdClosed(object sender, EventArgs args)
{
MonoBehaviour.print("HandleAdClosed event received");
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}