Skip to content

Instantly share code, notes, and snippets.

@atlass-dev
Last active June 13, 2021 08:03
Show Gist options
  • Save atlass-dev/0f531a2efdbd289b9ab6254dcc2776cc to your computer and use it in GitHub Desktop.
Save atlass-dev/0f531a2efdbd289b9ab6254dcc2776cc to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class InterAd : MonoBehaviour
{
private InterstitialAd interstitialAd;
private string interstitialUnitId = "ca-app-pub-3940256099942544/1033173712";
private void OnEnable()
{
interstitialAd = new InterstitialAd(interstitialUnitId);
AdRequest adRequest = new AdRequest.Builder().Build();
interstitialAd.LoadAd(adRequest);
}
public void ShowAd()
{
if (interstitialAd.IsLoaded())
interstitialAd.Show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment