OnUnityAdsShowComplete fired for all ad ids (rewarded ad and insterstitial) after Advertisement.Show

Hello,
I'm facing an issue when showing an rewarded ad and then an interstitial ad or vice versa with unity 2021.2.7f1 and Advertisement 4.0.0. This issue occures in editor and on internal android test on device installed over Play Store. The rewarded ad and interstitial ad are shown, but on the second and all following ads the OnUnityAdsShowComplete callback of both is fired with their id's. So the statement adUnitId.Equals(this.adUnitId) in the OnUnityAdsShowComplete is true on RewardedAdsButton with Rewarded_Android as id and also true on my InterstitialAdManager with Interstitial_Android as id. This causes the rewared ad to be rewared again and again on every following interstitial ad after showing the rewareded ad which is pretty a problem. My question is, if this is a bug which would probably could be solved if only the IUnityAdsShowListener would be fired which was passed in Advertisement.Show(adUnitId, unityAdsShowListener) or if my understanding of the Advertisement SDK is wrong.
Thank, David.

For a workaround I added the line

public static string LastShownId { get; private set; }

in my AdvertisementManager class and set it when show an ad like this

LastShownId = adUnitId;
Advertisement.Show(adUnitId, unityAdsShowListener);

and then in the callbacks I use it like

    public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
    {
        if (AdvertisementManager.LastShownId == adUnitId && adUnitId.Equals(this.adUnitId) && showCompletionState.Equals(UnityAdsShowCompletionState.COMPLETED))
        {
            // do stuff
        }
    }

I don't think this is the intended way but solves my issue.

I am facing this bloody issue. Rewards are getting assigned even after Interstitial Ads. I have tried to put Rewarded and Interstitial ad implementation in separate scripts having separate listeners. But even after that this issue is persist. It is a sever bug in Unity Ads and I wonder why it has not been addressed yet. So frustrating. I must say Unity Ads are still not mature enough when it comes to ease of use for developers. I found Google Ads SDK is far more easy to implement and almost bug free (at least it does not have this kind of basic bugs).

Thanks for the above workaround.

1 Like

@OblicaStudio I figgured out that my workaround for me didn't work propperly at all. It's possible to distinguish ad types but the unityAdsShowListeners are added in every call of Advertisement.Show and are never removed. This causes rewards to be payed out for first rewarded ad impression one time, for second rewarded ad impression two times, for third rewarded ad impression three times and so on...
I see no possibility to manually remove unityAdsShowListener in Ads 4.0.0 and I also didn't wanted to track the call number of an ad, to check for it's unique call id (if it is possible at all), so I downgraded Ads to 3.7.5 and now all is working properly again.
Maybe you will face the same issue in further testings, but wish you the best.

Ohh.. So you mean your workaround works well in 3.7.5 but not in 4.0.0? But I have tested it well and this is working fine for me even in 4.0.0. Rewarded Ads play and rewards getting assigns only one time.

1 Like

Hey @OblicaStudio , no, what I meant was, that the workaround doesn't work propperly with 4.0.0 for my app. With 3.7.5 I don't use any workarounds. But I really have no idea what really causes my issues with 4.0.0, so maybe 4.0.0 is working in your setup and I could had a wrong setup. Who knows. Now I'm happy with 3.7.5 because everything is working now. And nice, that the workaround works well in your app.

1 Like