Question by
catty01 · Aug 15, 2020 at 08:10 AM ·
adsadvertising
How do I pause all game activity until unity ad ends
I am making a mobile game with unity. I need to make it so that all game activity is paused while the ad is running. My ad script is below:
public void ShowAd()
{
Advertisement.Initialize(GameId, true);
StartCoroutine(ShowAdWhenReady());
}
IEnumerator ShowAdWhenReady()
{
while (!Advertisement.IsReady())
yield return null;
Advertisement.Show();
}
}
Comment
Answer by CoolCosmos · Aug 15, 2020 at 12:43 PM
Hi @catty01 , I don't know Unity ads codes exactly. There must be event functions about what to do while ads are playing.
You can set Time.scale equal to Zero(0) so all game would stop and then set it to One(1) to run it again after advertisement ends...