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.

Is it possible to change between exclusive fullscreen and borderless fullscreen in-game?

Discussion in 'Editor & General Support' started by fullscreenplz, Mar 23, 2017.

  1. fullscreenplz

    fullscreenplz

    Joined:
    Mar 23, 2017
    Posts:
    1
    The question:

    Hello, everyone! So, the only way I know to change between these two is by going to Edit > Project Settings > Player. But this solution only gives you one option, either you make a game exclusive fullscreen or you make it borderless, and I don't want to make two different builds just for that!

    There is also PlayerSettings.d3d9FullscreenMode and PlayerSettings.d3d11FullscreenMode, but those are only available using UnityEditor, so while I can change them via script, I can't change them in-game.

    One workaround is to use the command line argument "-window-mode=exclusive" before launching the game, for example, if the game only offers borderless fullscreen. But that's not enough. Many games let you choose that in the game options, why is that not possible with Unity? I don't want players to use a workaround (that requires some googling) for some basic feature that many games have.


    Why it matters:

    It's important to have both options available since many people have different experiences when it comes to exclusive/borderless. And no matter what's your opinion on which is the best one, why would it hurt to give the choice to the player?

    You would think, since Unity is a very popular engine, someone would've got that sorted out. Well... While I was searching for a solution, I saw a lot of players from Unity games complaining about no being able to choose between exclusive/borderless. These games being:
    • Oxenfree;

    • Firewatch;

    • Subnautica;

    • Overcooked;

    • SUPERHOT;

    • Ori and the Blind Forest;

    • Hearthstone;

    • 7 Days to Die;

    • Layers of Fear;

    • Rust;

    • Cities: Skylines.

    Maybe there were one or two more, but that's irrelevant. My point is that these games are all popular, and they all suffer from this problem (if I got any wrong, correct me please): either their fullscreen is borderless or it's exclusive. All of these games got complaints about that, and almost all (if not all) of the times the devs would answer players, they would just say that Unity forced them to choose only one fullscreen mode.


    I've already made a thread on Reddit, but no luck there. If it really is impossible to change between exclusive fullscreen and borderless fullscreen in-game, then why? Many games have that feature, shouldn't that be possible already? Especially for such a big engine like Unity. What can be done about that?
     
    Roman200333, Tayx and Khena_B like this.
  2. Tayx

    Tayx

    Joined:
    Feb 4, 2015
    Posts:
    66
    Bumping this for visibility, has anyone managed to do this?
     
  3. SixEyesStudio

    SixEyesStudio

    Joined:
    Aug 9, 2017
    Posts:
    9
    We've also been looking for a solution to this issue.
     
  4. GordGames

    GordGames

    Joined:
    Nov 7, 2016
    Posts:
    32
    Lethn likes this.
  5. SixEyesStudio

    SixEyesStudio

    Joined:
    Aug 9, 2017
    Posts:
    9
    Unless I'm mistaken, I think you didn't read correctly the OP's post. Changing resolution while in game in indeed trivial, and so is switching between fullscreen and windowed.

    The issue is swtiching between "Exclusive Fullscreen" and "Windowed fullscreen", which uses a Unity setting that is only available at compile time, not at runtime.

    That being said, I HAVE seen some unity games offer both options. I believe Kingmaker and Pillars Of Eternity 2 both allow the user to choose between "exclusive fullscreen" and "windowed fullscreen" and are using Unity, so there is certainly a way. I suspect they're using custom code to make it happen though.
     
  6. GordGames

    GordGames

    Joined:
    Nov 7, 2016
    Posts:
    32
    Apologies, I think I'm confused because the unity doc doesn't seem to match what's going on in my game. I used https://docs.unity3d.com/ScriptReference/FullScreenMode.html and when selecting "ExclusiveFullScreen" it does indeed go exclusive and stuff like GeForce overlay is enabled and it's definitely in exclusive mode. "FullscreenWindow" it goes borderless windowed and you can hit the win key and your start menu appears over the game window but I don't get any Window OS UI. When I select "Windowed" only then does the window max / min / close UI appear.

    I suggest trying it out and see what happens!
     
    SixEyesStudio likes this.
  7. SixEyesStudio

    SixEyesStudio

    Joined:
    Aug 9, 2017
    Posts:
    9
    Hah! Very interesting. That actually did the trick!
    It seems like:
    Screen.SetResolution(with, height, true);

    Will use whatever the "Player Settings -> Fullscreen Mode" value is, and that value cannot be changed at runtime, just build time (hence the confusion for some people, myself included).

    Whereas:
    Screen.SetResolution(width, height, FullScreenMode.ExclusiveFullScreen);

    Will correctly use Exclusive full screen, regardless of the "Player Settings -> Fullscreen Mode" value.

    I admit, I had not noticed the call with "FullScreenMode" rather than "bool isFullscreen" in the unity documentation.

    Thanks a lot for the help friend! :)
     
  8. GordGames

    GordGames

    Joined:
    Nov 7, 2016
    Posts:
    32
    Whoo! Glad you got it working! :)
     
    Roman200333 likes this.
  9. Tayx

    Tayx

    Joined:
    Feb 4, 2015
    Posts:
    66
    Thanks for clarifying! Can't believe I missed that
     
    Roman200333 and GordGames like this.
unityunity