Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

PlayerSettings are ignored when building windowed/fullscreen.

Discussion in 'Editor & General Support' started by CodeMasterMike, Jul 18, 2014.

  1. CodeMasterMike

    CodeMasterMike

    Joined:
    Oct 8, 2012
    Posts:
    5
    Hello!

    I have a issue which I noticed in both 4.3.4 and now also in 4.5.0.

    The problem is when I am building a exe file.
    First it doesn't matter if the "Default is fullscreen" is ticked or not. I always get either a windowed or fullscreen.
    And what I get is kind of predecided by Unity. But I think 99% its been fullscreen.

    To get windowed mode, I have to enable the "Display Resolution Dialog" in PlayerSettings, build the exe and run it, tick the windowed option, close the exe, go back and disable the "Display Resolution Dialog", and then rebuild a exe. But then I only get a windowed window, and I can't get a fullscreen.

    Another issue is that the exe file "remembers" what type of window mode I had the last time it was run.
    So if I start the exe in window, but goes to fullscreen, then next time I start the exe (without building a new one in Unity ofcourse) it starts in fullscreen. If I change to windowed, close it and starts it, it starts in windowed mode.
    I switch between window/fullscreen by changing the Screen.fullscreen boolean to true/false.

    What I want, is to ALWAYS start the exe in window mode, and manually while the exe is running to switch to fullscreen. And when I restart it should start in window mode, and not fullscreen.

    Have anyone else noticed this issue? Or is this a feature and not a issue?
    I have tried this on three different computers. Two with a pro licence (v. 4.3.4) and one with free (v 4.5.0).
    All three computers are Win7 computer.
     
  2. chechoggomez

    chechoggomez

    Unity Technologies

    Joined:
    Feb 25, 2013
    Posts:
    76
    This is not an issue, the full screen mode is saved in the application registers

    HKEY_CURRENT_USER ->Software->""Company Name"->"Produc Name"

    You will see :

    Screenmanager Is Fullscreen mode
    Screenmanager Resolution Height
    Screenmanager Resolution Width
    UnityGraphicsQuality

    So this is why the application remembers if it's Full screen mode or not.

    What you need to do to start always on windowed mode is to change the full screen mode by script:

    http://docs.unity3d.com/ScriptReference/Screen-fullScreen.html

    Screen.fullScreen = false;
     
  3. CodeMasterMike

    CodeMasterMike

    Joined:
    Oct 8, 2012
    Posts:
    5
    Thanks for the answer!

    Yes, it works changing it manually, so thats a workaround. Just a little counter productive...
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,288
    I think most apps remember their window position and size.
     
  5. CodeMasterMike

    CodeMasterMike

    Joined:
    Oct 8, 2012
    Posts:
    5
    Thats true, but the best way would be to make it optional to save the settings or something like that.

    I just find it little frustrating, when i want to do a build in window mode, i explicit set to window mode through the player settings, but getting a fullscreen because its stored in the registry.
    Yes, writing one line fixes that, but still...
     
    Last edited: Jul 19, 2014
  6. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    156
    I think you missed the issue, Graham. An app remembering previous settings is a feature, going against the user or programmer's explicit instruction is a bug (and what this thread is about). I know you must read a lot of these bug forum posts everyday, but simply reading one off-hand comment by a frustrated Unity user and adding a retort to an otherwise legitimate issue is a little unprofessional, belittling, and, well, frustrating.

    Having the same issue, setting the Screen.fullScreen variable actually made the problem worse for me. Complete failure, a quarter of my monitor was filled with black until I cntrl-alt-del escaped the executable. Can't say much more than that, it just started happening to my builds. Every time I attempt to build it simply defaults to full screen, no matter what I name the build or the location I build it to. About to restart my computer...

    EDIT: Scratch that, Unity is completely busted. Every build is ignoring all build settings. Attempting a re-install...?

    EDIT 2: After uninstall/re-install of Unity Editor, and wrestling for 4.5 hours I finally fixed it. It appears that having the D3D11 Force Exclusive Mode checkmark was at the crux of the issue. Whenever it is checked my builds are ignoring almost all build settings, most notably the Windowed checkmark. It always opens full screen when this checkbox is selected, and at an unknown resolution. I'm on Windows 8.1, Unity 4.6.5. However, judging by Graham's previous response, Unity appears unwilling to solve this issue making my effort for naught. Shame...
     
    Last edited: May 1, 2015
    Fattie and tdvance like this.
  7. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    371
    Also, on Windows 7 we often can't force the resolution dialog screen to appear when starting the app while holding any combination of alt, control or shift when starting the app. It works fine on OS X (hold option while opening the app). Creating a shortcut to the app and using the commandline argument '-show-screen-selector' also doesn't work for us. It appears that the player setting for the resolution dialog gets confused sometimes between enabled, disabled, or hidden by default.
     
    Last edited: May 10, 2015
  8. Detox_Anthony

    Detox_Anthony

    Joined:
    Aug 26, 2015
    Posts:
    2
    Having the same issue as greg harding - were you able to find a solution to this?
     
  9. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    371
    No, some of the options and commandline arguments continue to have varied performance for us :)
     
  10. Jadapa

    Jadapa

    Joined:
    Aug 19, 2017
    Posts:
    1
    Thanks, I had this "issue" too. The "Windowed" checkbox stoppped working when I updated to beta
     
  11. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    411
    Surely this can be fixed by Unity. So silly.

    Note that it works fine on Mac, but is broken on Windows.

    On Windows you have to add this

    Screen.fullScreen = false;

    as the first line of code that runs in your preload scene.
     
    Last edited: Mar 21, 2018
  12. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    411
    still not the slightest effort from Unity to fix this
     
    trappist-1 likes this.
  13. James-Covalent-Bond

    James-Covalent-Bond

    Joined:
    Feb 1, 2016
    Posts:
    2
    I have this problem too. I'm gonna try older versions and see how they work

    Edit: doesn't work on 2018.1.3f1
     
  14. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    411
  15. Fr33zerPop

    Fr33zerPop

    Joined:
    Apr 29, 2015
    Posts:
    9
    Screen.fullScreen = false;
    This successfully keeps my game from running fullscreen (Mac standalone), but my splash screen is still fullscreen until this code loads. Is there a way I can insert this into the splash's code?
     
  16. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    Sorry for resurrection, but I have found that the only reliable way to get around this is to simply delete the registry entries at:

    HKEY_CURRENT_USER -> Software -> [COMPANY_NAME] -> [PRODUCT_NAME]

    I have read in other threads that deleting all PlayerPrefs gets around it, but I can say that this is not reliable.
     
  17. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    57
    Well, you could just change the company name, i.e. temporarily, in the Player Settings, so that a new entry in the registry is made. This works for me every time.
     
  18. phygitalmadhouse

    phygitalmadhouse

    Joined:
    Jan 19, 2017
    Posts:
    7
    I found a workaround :

    -Build a game with enabled display resolution dialog

    -set the desired display features

    -run game

    -build again with display resolution dialog disabled.

    Works for me but is trully disturbing.This changes the register and done
     
  19. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    279

    LOL - I was going to do this today. I have a game that runs in letterboxed 4:3 and just won't go fullscreen no matter what I do. I got it working on my dev machine by enabling the resolution dialog, changing it there, and then disabling it - and now it runs fullscreen. Was going to do this on the prod machines today... but won't simply deleting the registry key for it have the same effect? Seems simpler...

    Thanks!
     
  20. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    411
    Correct @dmennenoh , do NOT do that workaround :)

    "Simply" delete the registry entries:

    On a Windows10 machine, click the "windows icon" at the bottom left, choose Run, type regedit in the Open box, and then click OK.

    Just go here ...

    "HKEY_CURRENT_USER" -> "Software" -> [COMPANY_NAME] -> [PRODUCT_NAME]

    "Company name" is the one you enterer in PlayerSettings

    "Product name" is the one you entered in PlayerSettings.

    Simply delete ALL of that "Product Name" entry.


    So embarrassing for Unity, it's been 5? years. So silly.
     
    Last edited: Feb 1, 2019
    mcmorry likes this.
  21. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    1,015
    I think I have a similar problem with 2018.2 but it is so bad now! - wanted windowed only app

    I ran my app and it was fullscreen and I could not switch to windowed (probably because I turned off fullscreen switch in player settings),
    so then I turned on display resolution dialog in settings and tried running non windowed at low resolution - it just ran fullscreen but lower resolution!! (maybe I got tick box wrong but I set fullscreen mode to windowed)
    so then I deleted registry key entries and ran again and finally it works

    Seriously Unity if an app disables some feature like fullscreen in player settings, then don't allow an app to run fullscreen - even if previously saved settings say to do so because that just causes a headache!
     
    Last edited: Jan 30, 2019
  22. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    411
    Right, it's just one of those funny long-term bugs in Unity.

    It has not been fixed for years and years and they will probably never bother fixing it.

    You just have to clear the registry over and over. :/
     
  23. awaralabs

    awaralabs

    Joined:
    Nov 28, 2018
    Posts:
    9
    and for mac?
     
  24. ultramegatronic

    ultramegatronic

    Joined:
    Nov 25, 2013
    Posts:
    1
    From the terminal run:
    defaults delete com.whatever.whatever

    where com.whatever.whatever is your app's identifier.