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.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

exclusive full screen mode

Discussion in 'Scripting' started by 2dgamemania, Sep 28, 2018.

  1. 2dgamemania

    2dgamemania

    Joined:
    Apr 30, 2014
    Posts:
    153
    Hi,

    Sorry if this has been answered but I couldnt find a answer for this.

    Is it possible to switch between fullscreen mode(borderless), exclusive fullscreen and windows mode in game.

    I dont want a command line option, I want the player to be able to select from these modes in game.

    Thanks

    Dave
     
  2. FernandoHC

    FernandoHC

    Joined:
    Feb 6, 2018
    Posts:
    333
    2dgamemania likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    By default standard OS key combinations are enabled as well, but you can disable these if you like. On Windows pressing Alt+Enter will switch your game between fullscreen borderless and window mode for example.
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,091
    Unity 2018.1 added support for it to SetResolution.
    Code (csharp):
    1. Screen.SetResolution(width, height, FullScreenMode.MaximizedWindow, refreshrate);
     
    Zklegon, -chris, FernandoHC and 2 others like this.
  5. 2dgamemania

    2dgamemania

    Joined:
    Apr 30, 2014
    Posts:
    153
    thank you guys :)
     
  6. 2dgamemania

    2dgamemania

    Joined:
    Apr 30, 2014
    Posts:
    153
    Worked a treat :)

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

    Screen.SetResolution(Screen.width, Screen.height, FullScreenMode.FullScreenWindow);

    Screen.SetResolution(Screen.width, Screen.height, FullScreenMode.Windowed);
     
    Necronomicron and Zklegon like this.
  7. SugarM_

    SugarM_

    Joined:
    Sep 13, 2018
    Posts:
    1
    But I used Screen.SetResolution(Screen.width, Screen.height, FullScreenMode.ExclusiveFullScreen);
    to change the resolution and executed two times, and my screen could not be clicked.What is the solution, please?