how do i stop the time and music while an ad is playing or does unity handle that by itself?
CodePudding user response:
I found an old forum post about ads...
https://forum.unity.com/threads/how-do-i-pause-the-game-while-the-ads-are-showing.332757/
"When running your app on device, the Unity Player will pause while Unity Ads are shown. However, if you are testing in the Unity Editor, the game is not paused while the placeholder ads are shown.
You could handle this by pausing audio playback and setting the timescale to > 0 while showing. Then un-pause the audio and restore the timescale value after the ad placeholder is closed."
So:
Time.timescale = 0;
and something like:
Camera.main.GetComponent<AudioSource>().Pause();