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

Bug [Found a solution] Bug with fullscreen mode on game build

Discussion in 'Editor & General Support' started by Deleted User, Aug 25, 2021.

  1. Deleted User

    Deleted User

    Guest

    I don't know if this is a known issue, but I think I found a pretty annoying bug...

    I made a game build (checking the "Allow Fullscreen Switch" from the Player section of the Project Settings) and having my fullscreen mode set to "Fullscreen Window" (from the Player section of the Project Settings as well), like this:

    Senza titolo-1.png

    Now when I run my built game, if I enable fullscreen mode, everything works fine...
    This is my game in fullscreen mode:

    Senza titolo-4.png

    However, if I resize my game window to a very small size (both horizontally and vertically), of course affecting how the game looks (the resolution gets smaller according to the window size), like this:

    Senza titolo-2.png

    then whenever I press the Alt + Enter shorcut to enter fullscreen from a small window size like the one above, it toggles fullscreen mode with the same resolution of when the game window was in the minimum size...
    Here you can see the game (in full screen) with a terrible resolution, due to the resolution the game window had as soon as I pressed the Alt + Enter shortcut to enter fullscreen mode:
    Senza titolo-3.png

    It seems like unity stretches the current game window to enter fullscreen mode instead of setting it up properly with the maximum screen resolution...

    However, when I set my "Fullscreen mode" to "Exclusive Fullscreen" (which is only available in Windows tho, and not in MacOS and Linux) from the "Player" section in the Project Settings, and then set the game to fullscreen in-game, it gets set to fullscreen correctly, with the maximum screen resolution possible (1920x1080 in my case) regardless of the game window size the game has when I press the Alt + Enter shortcut...

    Is there a way to make the "Fullscreen Window" resolution on fullscreen the same as the "Exclusive Fullscreen" resolution on fullscreen (or at least a decent resolution) without using exclusive fullscreen (which causes some problems in Windows)?
     
    Last edited by a moderator: Aug 25, 2021
  2. Deleted User

    Deleted User

    Guest

    I still think this is a bug (cause why wouldn't Unity make the resolution as good as possible when on fullscreen), but I found a solution, for everyone that has this problem too:
    whenever the screen is on fullscreen mode, I set the resolution to the maximum resolution in the array "Screen.resolutions" by script, like this:

    Code (CSharp):
    1. Screen.SetResolution(Screen.resolutions[Screen.resolutions.Length - 1].width, Screen.resolutions[Screen.resolutions.Length - 1].height, Screen.fullScreen);
    this fixes my problem but I still think Unity should do this automatically when the game goes fullscreen...