googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.37k stars 1.08k forks source link

Unity Editor - Interstitial disappears on scene change and Time.timeScale remains = 0 #1873

Closed Francesco-FL closed 1 year ago

Francesco-FL commented 2 years ago

[REQUIRED] Step 1: Describe your environment

I'm in a scene. To switch to another scene I have to click a button. The button has two events, the first is scene change, while the second shows an interstitial (already loaded).

When I am on the app in the phone and I click on the button everything is fine, the scene changes and in the meantime I am shown the announcement, I close the announcement and the scene, as I said, has changed.

When I am in the editor, however, if I click the button, the interstitial is not shown. it's as if the scene change annoys him in the editor, and makes him disappear. It seems a marginal problem, but it is not, as showing an interstitial generates the "Pause Game" (DummyAdBehaviour: PauseGame ()), and the disappearance of the interstitial (having therefore disappeared due to the scene change and therefore not being able to close it from button to close the ad), the "Resume Game" (DummyAdBehaviour: ResumeGame ()) is not generated.

So, back to the initial example. If I am in the editor and I click that button, the "Pause Game" is generated, the scene is changed and the interstitial has disappeared. So in the new working scene I'm in, by way of I think the "Pause Game", I have a Time.timeScale = 0, which messes up all the code that works with Time. This messes up the tests done in the editor.

NVentimiglia commented 2 years ago

Hi @FreeLearningApps,

Let me rephrase this so that we can confirm understanding.

  1. We call InterstitialClient.ShowAd which pauses the game.
  2. The expected flow is the user closes the Interstitial, which resumes the game. This flow is not executed because of a scene change.
  3. We need to handle for scene changes on our end, so that when the scene changes the app may retain normal function. Perhaps we can flag the interstitial as DoNotDestroy or handle its destruction.

Is this correct?

Francesco-FL commented 2 years ago

Yes it's correct. From my experience the interstitial is normally put in the scene change, so I guess that in the editor it has to survive, as it happens in the published apps

kunny commented 1 year ago

Since there were no recent activities for this issue, we are therefore reluctantly going to close this bug for now.

If you are still experiencing the problem, please file a new issue with the same description, what happens and system / network tracing / Charles logs.

All system setups can be slightly different, so it's always better to open new issues and reference the related ones. Thanks for your contribution.