- Home /
AdMob Custom Banner Size
Hey guys, I've recently finished my first Unity game and I am currently in the process of implementing ads using AdMob. I was wondering if it is possible to change the size of the banner ads to anything other than the standard sizes listed here: https://developers.google.com/admob/unity/banner#banner_sizes
Each time I try to change the banner size using
AdSize adSize = new AdSize(300, 80);
this.bannerView = new BannerView(bannerID, adSize, AdPosition.Bottom);
I get this error
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <437ba245d8404784b9fbab9b439ac908>:0)
GoogleMobileAds.Unity.BannerClient.CreateBannerView (System.String adUnitId, GoogleMobileAds.Api.AdSize adSize, GoogleMobileAds.Api.AdPosition position) (at Assets/GoogleMobileAds/Platforms/Unity/BannerClient.cs:78)
GoogleMobileAds.Api.BannerView..ctor (System.String adUnitId, GoogleMobileAds.Api.AdSize adSize, GoogleMobileAds.Api.AdPosition position) (at Assets/GoogleMobileAds/Api/BannerView.cs:30)
AdManager.RequestBanner () (at Assets/Scripts/AdManager.cs:32)
TouchInput.EnableTouch () (at Assets/Scripts/TouchInput.cs:99)
UnityEngine.Events.InvokableCall.Invoke () (at <94c5f4c38cdc42d2b006f8badef04394>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <94c5f4c38cdc42d2b006f8badef04394>:0)
UnityEngine.Timeline.SignalReceiver.OnNotify (UnityEngine.Playables.Playable origin, UnityEngine.Playables.INotification notification, System.Object context) (at Library/PackageCache/com.unity.timeline@1.2.10/Runtime/Events/Signals/SignalReceiver.cs:32)
and the banner doesn't load. If I change the AdSize() arguments to one of the standard sizes (e.g. AdSize(320, 50)), it works without throwing an error but the banner width is too large. Any suggestions would be greatly appreciated.
Answer by gun_man · Aug 03, 2021 at 12:29 PM
Unfortunately there is no way to resize admob banner
I read here https://forum.unity.com/threads/solved-what-are-unity-banner-dimensions.578812