googleads / googleads-mobile-unity

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

Custom banner sizes throw a KeyNotFoundException in the editor #1503

Closed Seanm07 closed 1 year ago

Seanm07 commented 3 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2:

Dynamic banner ads are not supported by the editor banner previews and instead just throw a KeyNotFoundException

Steps to reproduce:

Load and show a banner using a custom banner size such as new AdSize(345, 678)

Relevant Code:

The issue is in BannerClient.cs and affects lines 78 and 101:

LoadAndSetPrefabAd(prefabAds[adSize]);

This is because the prefabAds dictionary only supports a few ad sizes:

private Dictionary<AdSize, string> prefabAds = new Dictionary<AdSize, string>()
        {
            {AdSize.Banner, "DummyAds/Banners/BANNER"},
            {AdSize.SmartBanner, "DummyAds/Banners/SMART_BANNER" },
            {AdSize.MediumRectangle, "DummyAds/Banners/MEDIUM_RECTANGLE" },
            {AdSize.IABBanner, "DummyAds/Banners/FULL_BANNER" },
            {AdSize.Leaderboard, "DummyAds/Banners/LEADERBOARD" },
            {new AdSize (320,100), "DummyAds/Banners/LARGE_BANNER" }
        };

The CreateBannerView function should either not call LoadAndSetPrefabAd for unsupported ad sizes or support for custom ad sizes should be added.

Seanm07 commented 3 years ago

Just an update to say this issue is still not fixed in the current latest 6.1.0 release of the plugin.

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 again!