using UnityEngine;
using GoogleMobileAds.Api;
public class AdIns : MonoBehaviour
{
private BannerView bannerView;
private InterstitialAd interstitial;
private string adUnitId;
[System.Obsolete]
private void Awake()
{
MobileAds.Initialize((InitializationStatus initStatus) =>
{
RequestInterstitial();
});
}
void Start()
{
// Initialize the Google Mobile Ads SDK.
}
private void RequestInterstitial()
{
adUnitId = "ca-app-pub-2771443006207374/3192777923"; // test id
// Clean up interstitial before using it
if (interstitial != null)
{
interstitial.Destroy();
}
AdRequest request = new AdRequest.Builder().Build();
InterstitialAd.Load(adUnitId, request, (InterstitialAd ads, LoadAdError loadAdError) =>
{
if (loadAdError != null)
{
return;
}
else
if (ads == null)
{
return;
}
Debug.Log("Interstitial ad loaded");
interstitial = ads;
});
}
public void ShowInterstitialAd() // Show
{
if (interstitial != null && interstitial.CanShowAd())
{
interstitial.Show();
}
}
}
Hello,
Did you remove all GMA folders/files before updating? It seems like something corrupted in your project while updating.
I’d recommend reimporting them all and seeing if your project has the correct prefab files.
8 Likes
Thnak you
give this man a prize ! Thank you Yasuyuki!
Thank You,
thankss
I SLOWING THIS IS A ERROR