Call method after displaying ads

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():wink: 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);

Anyone?

Solved it using the following callback, normally itโ€™s for video ad rewards. But this will do:

    public void showAd()
    {
        playSound = false;

        if (Advertisement.IsReady("video"))
        {
            ShowOptions options = new ShowOptions();
            options.resultCallback = HandleShowResult;
            Advertisement.Show("video", options);
        }
    }
    private void HandleShowResult(ShowResult result)
    {

        switch (result)
        {
            case ShowResult.Finished:
                musicManager.UnPause();
                break;
            case ShowResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                musicManager.UnPause();
                break;
            case ShowResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                musicManager.UnPause();
                break;
        }
    }