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. Dismiss Notice

Wrong Screen Height on Pixel 2 XL

Discussion in 'Android' started by yffum1, Aug 26, 2018.

  1. yffum1

    yffum1

    Joined:
    Aug 26, 2018
    Posts:
    5
    Hi, I'm working on a 2D Android game in Unity 2018. When I start the .apk, on almost every phone I've tested, it works fine. But on my friend's Pixel 2 XL, a bottom slice of the screen is not rendered (even for the Unity splash screen!). The game renders as if the phone's screen is an inch shorter from the bottom. And in that inch of unused screen on the bottom is usually whatever the phone was displaying before (e.g. the wallpaper).

    I consistently reproduce this exact error on an emulated Pixel 2 XL in Android Studio. I also found that on both the real Pixel 2 XL and the virtual one, Screen.height returns 2678 even though the vertical resolution of the phone is 2880 pixels. It seems my entire app thinks the phone's screen is 1440x2678 when it is actually 1440x2880.

    Edit: I've added screenshots. They're a little blurry cause I edited out some art.

    Here is the screenshot from my One Plus 5T, (which is how the game looks on every other phone I try):


    Here is how the game looks on the Pixel 2 XL (both real and virtual):


    Screen.fullscreen is true. I can't seem to fix it.

    Anyone have any idea what's going on?

    Thank you for any input!
     
    Last edited: Aug 27, 2018
  2. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    69
    I couldn't reproduce on an empty project. Could you send in a minimal repro project and let me know the bug number?


    (P.S Note 8 is running in 'Optimized Performance Mode' so it's screen is in 'FHD+' instead of 'WQHD+' aka 1080x2220 instead of 1440x2960)
     

    Attached Files:

  3. yffum1

    yffum1

    Joined:
    Aug 26, 2018
    Posts:
    5
    Sorry, I'm very new to Unity and Android Development. I made an empty project and it didn't have the issue so I compared it to my current one and realized I had set the build system to "Internal". Setting it to gradle fixed the issue and I'm pretty fine with that except it seems to have raised the file size.

    I'm not sure what the bug number would be, but the empty project has the same exact issue when set to internal build system. Should I zip that project directory and send it to you?

    Thanks for your quick response!

    edit: changed "new project" to "empty" for clarity
     
    Last edited: Aug 29, 2018
  4. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    69
    Thanks yffum1, I was able to reproduce when switched to Internal build system. I will report the issue myself : )
     
  5. yffum1

    yffum1

    Joined:
    Aug 26, 2018
    Posts:
    5
    Cheers! :)
     
  6. juanelo

    juanelo

    Joined:
    Jan 28, 2011
    Posts:
    46
    So, is the conclusion that there's a bug with the internal build system causing that gap in Unity 2018?
    We're using 5.6 and are having the same issue.

    Just want to confirm.
     
  7. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    We are not sure what causes this issue as applications built with internal build system and gradle have same manifests. We have reported it to Google, but haven't got an answer yet.
    During our internal testing we've seen that when max aspect ratio is specified in the manifest, there is no black bar (full screen is used) even when the application is built with internal build system. The problem only happens when the max aspect ratio is not specified. So it's possible to solve this issue even in Unity 5.6.