Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. We are looking for your feedback about Templates! Tell us about your experiences by taking our survey.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Fullscreen issues on Mac

Discussion in 'macOS' started by mudloop, Sep 20, 2019.

  1. mudloop


    May 3, 2009

    I noticed some issues with fullscreen mode on mac.

    - If I change fullscreenmode in one Unity game, then open another game, it follows what the other game had. So I'm guessing the preferences for this are shared between games for some reason? This is undesirable...
    - If I go to windowed mode, then back to fullscreen, there's annoying black bars

    Because of this, I want to manage fullscreen myself, by checking if fullscreen changed, and then setting the resolution to the user's choice (or if there is no choice, an initial resolution).

    ... But I'm not sure how to determine the initial resolution.

    I saw someone post a while back that they grabbed it at launch, but that doesn't seem to work because Unity shares fullscreen preferences between games, so I can't be sure that at first launch, it's native resolution.

    The closest I've gotten is using Display.main.systemWidth and Display.main.systemHeight, but on retina screens, this returns half the resolution.

    So I'd want to check if the double of that is a supported resolution (by looping through Screen.resolutions). This worked on my system, but when my artist tried it on his macbook, it didn't recognize that as a real resolution.

    Furthermore, on his macbook (which is a modern retina device), Screen.resolutions didn't contain any of the resolutions that you would expect. He had some 4:3 resolutions etc, but almost no 16:9 or 16:10, and not his native resolution either.

    So it would appear Screen.resolutions is not even reliable?

    If the default fullscreen management doesn't work, and we don't have the information to do it ourselves reliably, how are we supposed to make fullscreen games? :)

    I know people are doing it, and I'm probably overcomplicating things, but I have no idea how to make fullscreen mode work reliable.

    Any advice would be greatly appreciated. Thanks!