Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bug AdMob size mismatch

Discussion in 'UI Toolkit' started by twell59, Aug 27, 2023.

  1. twell59

    twell59

    Joined:
    Feb 6, 2016
    Posts:
    25
    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?
     
    Last edited: Aug 27, 2023
  2. uBenoitA

    uBenoitA

    Unity Technologies

    Joined:
    Apr 15, 2020
    Posts:
    198
    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.
     
  3. twell59

    twell59

    Joined:
    Feb 6, 2016
    Posts:
    25
    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.