- Home /
deactivate script for time period when script is used
i have a script and when i enable it i want it to deactivate for 3 minute then to be activated again when i trigger the script. so basically when i press play i want an ad to show then it wont show for 3 minutes when you press play and then after the 3 minutes are over next time you press play it activates the ad.
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
Your answer
Follow this Question
Related Questions
How to make a timer? 2D GAME 1 Answer
Showing and Hiding guiText 1 Answer
How to disable halo when it is already enabled via script C# 0 Answers
How can I set a timer? 1 Answer
WaitForSeconds Not Working 1 Answer