- Home /
Question by
chesterhilly · Mar 12, 2016 at 06:39 PM ·
timeadsdelay
Delay Advertisements when switching between scenes?
So I have have a script that plays an add every 90 seconds. Every time you change scene (which is quite regular) An ad pops up.
Does anyone know how to delay this
Script:
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
public class ShowAds : MonoBehaviour
{
float timer;
void Start()
{
Advertisement.Initialize ("<YOUR GAME ID HERE>"); //REMEMBER TO EDIT!!
}
void Update()
{
timer -= Time.deltaTime;
ShowAd ();
}
public void ShowAd()
{
if (Advertisement.IsReady () && timer <= 0)
{
Advertisement.Show ();
timer = 90.0f;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Do something every 0.5 seconds 3 Answers
Animator idle minimal delay 0 Answers
Unity IAP InitializePurchasing taking too long. 1 Answer
How to load ads before showing? 0 Answers
Cycle Textures Over Time 2 Answers