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

Adaptive banners don't work if width is less than AdSize.FullWidth #3183

Closed raft75 closed 3 months ago

raft75 commented 4 months ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

I'm trying to display adaptive banners with a custom width:

AdSize adaptiveSize = AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth((int)(AdSize.FullWidth * 0.8));

In logcat I see the following error: Ad request doesn't meet size requirements.

I'm trying to do this because I'd like to switch from deprecated Smart Banners to Adaptive Banners, but I find that, in landscape, the Adaptive Banner is almost double the Height of the Smart Banner.

My apps are landscape oriented only. On my mobile phone (Xiaomi 11 Lite 5G NE) resolution 2400x1080, I get the following sizes for a full width banner: Adaptive Banner: 2164 x 162 Smart Banner: 2167 x 88

So my idea was to provide a custom width to display a smaller banner. It seems that this is not possible at all. What am I missing?

Moreover, the dummy placeholder banner in Unity Editor has not a realistic size, it's way smaller than it is on a real device (even when setting the Unity Editor screen to match device resolution) so it's not useful to test and design the layout at different resolutions.

NVentimiglia commented 4 months ago

I agree this is an issue and have recommended that this gets fixed b/326123984.

The reason this does not work is that the value of AdSize.FullWidth is const -1 with -1 being a convention used internally. This value (and AdSize.width) is never updated. I suggest you find the screen width another way, maybe Screen. width.

NVentimiglia commented 3 months ago

This issue is accepted by engineering, and I am closing issue here.