Show Interstitial Ad
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class Ad : MonoBehaviour
{
public string InterstitialAdID;
InterstitialAd MyinterstitialAd;
private void start()
{
MyinterstitialAd = new InterstitialAd(InterstitialAdID);
}
public void LoadInterstitialAd ()
{
AdRequest requeset = new AdRequest.Builder().Build();
MyinterstitialAd.LoadAd(requeset);
}
public void showInterstitialAd()
{
if (MyinterstitialAd.IsLoaded())
{
MyinterstitialAd.Show();
}
else
{
LoadInterstitialAd();
}
}
}
No comments:
Post a Comment