AdMob size mismatch

  1. I created a 360 x 640 dp (1080 x 1920 px) canvas in UI Toolkit with a 320 x 50 dp AdMob banner AD placeholder and it looks correct in the UI Toolkit builder.
  2. But when I hit “Play” in a 360 x 800 dp (Pixel 7) preview device it doesn’t look correct. The AdMob banner AD doesn’t cover exactly the size of the 320 x 50 dp placeholder.

How can this be fixed?

Hi twell59,

Is this only bugged when you’re displaying an add banner? If you keep the placeholder button, does it show at the right location? It would be easier to answer your question if we could first remove the extra complexity from the banner specifics, as the banner implementation code might be doing all kinds of weird things and it might be impossible to control it externally.

There has to be something wrong there because also “Screen.safeArea” returns wrong top/left offset for most devices in the “Simulator” panel but for iPhones “Screen.safeArea” returns the correct values and coincidentally AdMob looks correct on iPhones. Weird coincidence? I don’t think so.
Also, AdMob looks correct in Android Studio and on actual physical device, so IMO Unity is giving it wrong values somewhere.