Sorry for this newbie question.
I have a simple method that calls the ads in unity. Just right before the ad is shown I disable the audio by pausing it to musicManager.Pause();
Now after the ad has finished showing I want to call a method where I unpause (musicManager.UnPause()
the music. So far Iโm out of luck trying. Any suggestions? This is partly the code:
Code for calling the ads:
//Unity Ads Show When Ready
public void ShowAd ()
{
musicManager.Pause();
//#if UNITY_EDITOR
StartCoroutine(WaitForAd());
playSound = false;
//#endif
}
//Wait for the ads to be ready and can be shown
IEnumerator WaitForAd ()
{
while (!Advertisement.IsReady())
yield return null;
Advertisement.Show();
}
Part of the code where the ad is called:
if (ScoreManager.instance.GetPrevHighScore () >= ScoreManager.instance.GetScore ()) {
//Debug.Log(" PrevHighScore was: " + ScoreManager.instance.GetPrevHighScore() + ", Score now is : " + ScoreManager.instance.GetScore());
scoreText.SetActive (false);
scoreTextCoin.SetActive (false);
imageCoinOnGame.SetActive (false);
powerBar.SetActive (false);
jumpButton.enabled = false;
//ShowAd Unity ads
int number = Random.Range (1, 6);
if (number == 4) {
ShowAd ();
}
gameOverpanel.SetActive (true);