Hello,
I added to my project AdMob system. I’m using interstitial ads, everything works fine. It works in such a way that after the end of the game, a button appears, which is to load the next scene (the ad appears when you click it), unfortunately the ad appears for about 1 second and the scene is loaded. The user has no time to close the ad. What condition can I use if I want the scene to load only after the ad is closed?
There is a callback when the interstitial ad is closed, you can load the next scene in that.
I found it. Thanks
I have the same problem. How should I use the callback function?
Hi
I was just googling around to solve a similar ad loading issue. I think I can answer your question. When you set up your interstitial ad you can create a callback function for InterstitialAd.OnAdClosed. In this callback you can then load the scene that was going to load when the button was clicked.
To initiate the ad being shown you can have a public function that gets called with the name of the scene to load as a param. Keep this as a string in your admanager and then call interstitial.show (providing you loaded the ad… etc).
then when the onAdClosed callback occurs just call your scenemanager and load the intended scene.
Just remember to use the ad failure call backs to cover your bases so that the app does not get stuck if the ad fails to show for some reason.
Ironically writing it out has just helped me solve my own problem.
Hope this helps you, or maybe someone else in future.
Edit: someone asked me for more detail. Did a quick example at https://forum.unity.com/conversations/about-interstitialad-onadclosed.597485/#message-1191263
The code is far from complete but should convey the idea. Corrections and comments welcome.
Thank you so much you helped me
Glad to hear!