Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Screen.safeArea is broken on iPhone XS Max under 2018.2.18

Discussion in 'iOS and tvOS' started by yakandco, Dec 5, 2018.

  1. yakandco

    yakandco

    Joined:
    Dec 3, 2014
    Posts:
    90
    I don't know how far back this goes in terms of versions, but this was working on 2018.2.12. I've just built on an iPhone XS Max and logged Screen.safeArea and I get the screen resolution.. not the safe area:
    (x:0.00, y:0.00, width:2688.00, height:1242.00)

    safe area for this device should be reported as:
    (x:132.00, y:63.00, width:2424.00, height:1179.00)


    iPhone XR also doesn't work as expected.

    So annoying that these safe area values are not reliable, it's potentially cost us featuring opportunities. I've also had mixed issues with the safe area on iPhone 7 Plus where the screen resolution reports as 1920x1080, yet the safe area comes back as ( 0f, 0f, 2208f, 1242f ) which is a higher resolution than the reported screen res making it unusable for any kind of dynamic safe area handling solution. I recall that there was some odd resolution handling with the iPhone 7 which is why it comes back as 1920x1080, but if you adjust the reported resolution for the 7 plus can you please adjust the safe area to match or provide some better examples on how we should handle this problem.

    The only reliable solution currently is to hard code safe area values, but this is not going to be an option for android. There's dozens of devices now with notches that we're stuck on rolling out a solution for.
     
    JustAnotherDude likes this.
  2. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    I just noticed that changing quality is also an issue now because unity is returning a safe area as x:0.00, y:0.00, width:0.00, height:0.00 for a frame, this completely broke my "auto adjusting script" in a way I haven't discovered yet why...
     
  3. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481