Pausing the game pauses test ads? (Unity Mediation Beta v.0.5.1-preview1)

Hello
Unity Mediation Beta v.0.5.1-preview1 question.
Unity 2021.3.8f1

I couldn’t find an answer on the forum so I’d like to ask. If it is explained anywhere in the documentation please let me know where to find it. Thank you.

The problem (a bug or my wrong implementation):
In Unity Ads, in the Editor and on Android device I was able to pause the game while ‘test ad’ was being presented (Interstitial or Rewarded Ads). The game was correctly paused with these two lines of code:

        //Pause game.
        Time.timeScale = 0;
        AudioListener.pause = true;

Closing the ad was correctly restarting the game where it left off before ‘test ad’ was started to show.

        //Re-Start game.
        Time.timeScale = 1;
        AudioListener.pause = false;

In Unity Mediation Beta v.0.5.1-preview1 when I use the same two lines of code to pause the game it appears that it pauses the ‘test ad’ as well or just the animation at the bottom (thin line)? Both Interstitial and Rewarded Ads.
Unity Mediation ‘test ad’ without these two lines of code animates loading/presenting the test ad at the very bottom (thin blue line) correctly and finishes 100% (running from left to right).
With two lines of code added to ShowInterstitial() it does not animate. The game is paused correctly but the test ad seems to be paused as well?
Here’s my testing code snippet that prevents ‘test ad’ from running to the end (left to right animation). Could it be that it’s only visually affected but the ad works ok?

public async void ShowInterstitial()
        {
                    //Pause game.
                    Time.timeScale = 0;
                    AudioListener.pause = true;
          
            if (m_InterstitialAd?.AdState == AdState.Loaded)
            {
                try
                {
                    var showOptions = new InterstitialAdShowOptions { AutoReload = true };
                    await m_InterstitialAd.ShowAsync(showOptions);
                }
                catch (ShowFailedException e)
                {

                }
            }
        }

I also tried to place it within ‘try - catch’ before and after:

await m_InterstitialAd.ShowAsync(showOptions);

…but it made no difference. I also tried to run pause/restart logic in the Update method but it also didn’t work for me.
Your help would be really appreciated.
Thank you

Hi @71kris
To clarify, by test ad do you mean the ad in the editor? If so, this is expected, these test ads are only there to help setup and test the app flow/ads. They are just Unity UI elements and will behave as such.
If however you mean test ads on device, this is a serious issue we should investigate.

Hello jcGrenier
Thank you for your reply. I can confirm that I meant in the Editor. I’ve just tested on a device and this was not an issue.

For anyone coming across this - As a workaround I had to add this bit of code (below), otherwise I wouldn’t be able to test in the editor and compiling + deploying to a device is not the fastest way of checking things out.

With this bit of code I have it working both in the Editor and on a device:

//Pause game.
#if UNITY_EDITOR
            Time.timeScale = 1; // Testing in the Editor it has to run otherwise test ad won't be playing. It also means that enemies can still attack in the background and anything else can be running in the background! Not ideal...
#else
            Time.timeScale = 0; // Testing on a device test ad is playing as expected.
#endif
            AudioListener.pause = true;

I had no such problem in Unity Ads where simply having:

Time.timeScale = 0;
AudioListener.pause = true;

…was working both in the Editor and on a device.
I still believe that this is a bit of a pain (flaw) in the Unity Mediation implementation.
Thanks anyway.

Thanks for your feedback, we will look into making the editor mock ads more resilient to timescale changes :slight_smile: