googleads / googleads-mobile-unity

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

App Open ads malfunction during testing in the Unity Editor #3151

Closed amjaliks closed 3 months ago

amjaliks commented 4 months ago

Step 1: Describe your environment

Step 2: Describe the problem

When I attempt to display the App Open ad in the Editor, it briefly flashes and then immediately closes (disappears) by itself. After the ad closes, it fails to call the OnAdFullScreenContentClosed callback.

The code loading the App Open ad:

AppOpenAd.Load(appOpenAdUnitId, request, (ad, _) => {
    var success = ad != null;
    if (success) {
        appOpenAd = ad;
    }
});

The code showing the App Open ad:

appOpenAd.OnAdFullScreenContentOpened += () => {
    onShown?.Invoke();
};
appOpenAd.OnAdFullScreenContentClosed += () => {
    onClosed?.Invoke();
};

appOpenAd.Show();
NVentimiglia commented 4 months ago

I was not able to see any issue on the HelloWorld AppOpen Sample.

Please take a look at the sample code to make sure there is nothing else going on in your code which might cause the ad to close prematurely. Also try adding some log statements around OnAppStateChanged as that could trigger the ad to show.

If you push a more complete sample I can take another look.