- Home /
Ads on timers
for my game I have a script which will put ads into it. After the fist ad is shown then there will be no ads for 3 minutes until you press the button again that enables ads. For example you press play the ads show and then when they end they dont appear for another 3 minutes and then when you press play after the 3 minutes the ads play again. Here is my script with the app ID missing for reasons.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class AdMobManager : MonoBehaviour
{
private BannerView bannerView;
[SerializeField]
private string appID =
[SerializeField] private string bannerID =
[SerializeField] private string regularAD =
private void Awake()
{
}
public void OnClickShowBanner()
{
this.RequestBanner();
}
public void OnClickShowAd()
{
this.RequestRegularAD();
}
private void RequestRegularAD()
{
InterstitialAd AD = new InterstitialAd(regularAD);
AdRequest request = new AdRequest.Builder().Build();
AD.LoadAd(request);
}
private void RequestBanner()
{
bannerView = new BannerView(bannerID, AdSize.Banner, AdPosition.Bottom);
AdRequest request = new AdRequest.Builder().Build();
bannerView.LoadAd(request);
}
}
Comment