Last active
June 13, 2021 08:03
-
-
Save atlass-dev/0f531a2efdbd289b9ab6254dcc2776cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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