Search Unity

Bug Wrong resolution on Macbook pro 2021

Discussion in 'macOS' started by YannisQG, Oct 14, 2022.

  1. YannisQG

    YannisQG

    Joined:
    Oct 14, 2022
    Posts:
    3
    Hi,

    Making a game on Unity, we saw that the resolution returned by the functions like Screen.currentResolution or Display.main.systemWidth and Display.main.systemHeight don't set the proper one on Macbook pro M1 2021.

    https://support.apple.com/kb/SP854?viewlocale=en_US&locale=ja_JP

    In fact, after a dynamic set with those, my screen keeps a 16:9 resolution and black bars are visible on left and right side.

    Did you encounter this issue ?
     
  2. YannisQG

    YannisQG

    Joined:
    Oct 14, 2022
    Posts:
    3
    This is the answer.

    The problem was that the resolution I got included the notch of the new macbook pro.
    I created a plugin to recover the safe area and the margin on all direction. The result is better but not perfect.
    We have still black bars on sides but a lot thinner than before.
    Apparently the safeAreaInsets are not that accurate that they should or an external problem avoid me to be.

    https://developer.apple.com/documentation/appkit/nsscreen/3882821-safeareainsets?language=objc
    https://developer.apple.com/documentation/appkit/nsscreen/1388369-visibleframe?language=objc
     
  3. YannisQG

    YannisQG

    Joined:
    Oct 14, 2022
    Posts:
    3
    more info.

    The visible frame doesn't work well at the app start so I prefered to use the safeAreaInsets and reduced my resolution manually. Moreover, the margin only includes the notch size but the true safe area has the menu bar height so I use the margin just to check if a notch was there and reduce the height with menu bar heigh I got.

    https://developer.apple.com/documentation/appkit/nsmenu/1518141-menubarheight?language=objc

    problem solved. =-)
     
  4. fitboyawesome

    fitboyawesome

    Joined:
    May 9, 2023
    Posts:
    2
    I haven't personally encountered this specific issue, there are a few things you can try to address it. First, ensure that you have the latest version of Unity installed, as newer updates often include bug fixes and improvements.

    You can also check the display settings on your MacBook Pro M1 to verify if the proper resolution and aspect ratio are set. Go to System Preferences > Display and confirm that the settings match your desired resolution and aspect ratio.

    Additionally, you might want to explore Unity's documentation or forums to see if other developers have encountered a similar issue and if any solutions or workarounds have been shared. Unity's community is active and often provides helpful insights and troubleshooting tips.
     
  5. joao_maia_u3d

    joao_maia_u3d

    Unity Technologies

    Joined:
    Dec 15, 2021
    Posts:
    6
    Hi. We fixed this issue and
    Screen.currentResolution
    should return the screen resolution without the notch area as of 2021.3.21f. Please let us know if you have any other problems :)