Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. 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:
    91
    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

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    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:
    161
    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
    Joy-less, Reahreic, Deniii and 3 others like this.
  7. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    525
    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. Deleted User

    Deleted User

    Guest

    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:
    525
    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:
    476
    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
    unity_4IQi75wZq_MD6g likes this.
  12. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    still not the slightest effort from Unity to fix this
     
    deus0, AGregori, Shadoninja and 2 others like 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:
    476
  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.
     
    Joy-less, miracalious and stevepdp like this.
  17. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    61
    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.
     
    lelias_unity likes this.
  18. phygitalmadhouse

    phygitalmadhouse

    Joined:
    Jan 19, 2017
    Posts:
    12
    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:
    379

    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:
    476
    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
  21. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,335
    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:
    476
    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. :/
     
    deus0 and Rayeloy like this.
  23. pabloawara

    pabloawara

    Joined:
    Nov 28, 2018
    Posts:
    10
    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.
     
  25. pabloawara

    pabloawara

    Joined:
    Nov 28, 2018
    Posts:
    10
    Thanks!
     
  26. heronww

    heronww

    Joined:
    Sep 8, 2019
    Posts:
    30
    2019.3f issue still persists.
     
    Last edited: Nov 10, 2019
    CloudyVR and Rayeloy like this.
  27. unity_6_EkiNr9Kjm8VQ

    unity_6_EkiNr9Kjm8VQ

    Joined:
    Dec 11, 2018
    Posts:
    4
    There is a very simple solution for this bug, just make the Display Resolution Dialog enabled and uncheck the Allow Full Screen Mode. It will work fine and also you can resize the window.
     
  28. JonTerp

    JonTerp

    Joined:
    Aug 20, 2014
    Posts:
    9
    It's 2020 and this is somehow still a bug in the engine, and one that I run into pretty often.

    It hurts most when deploying builds to testers when we've changed default screen settings or want to lock the screen to a certain res in a prototype app given to clients. This can create very annoying bugs where the client is using an unsupported resolution they set before the new build.

    At the very least have check for incremented version number and a check box (or API function) to optionally reset the user's window size settings.
     
    deus0 likes this.
  29. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You could provide a batch file which deletes the registry keys holding the screen settings. Provide that to any testers who have previously tested your game before you changed the default settings.

    Or you could in your first scene check the current screen settings and if they are unsupported just force them to the correct settings.
     
  30. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    256
    2020 and this bug is still here. Particularly for 'resizable window'. After reading the post I altered the company name and seen resizable windows working. Before that the resolution settings did not make any change. I'm using linux so the above solutions do not work. If starting my game in full screen mode as well, and i switch it with in game settings, it's still not resizable. It gets stuck. not to mention there is no way to change what display it starts on or anything. There's only (display.Activate()) which doesn't actually change what display the main window is on.

    For such a long surviving game engine it seems that for the basic stuff it can't do right. At least for new engines like Godot, I don't expect this to be a problem. If it's open source it can get fixed a lot quicker.
     
    Last edited: Jan 11, 2021
  31. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    It is utterly amazing that Unity have this completely F***ed-up.

    It is just flabbergasting.

    There are multiple bad bugs around the issue.
     
    miracalious and yyylny like this.
  32. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Welp, I guess it's my turn. My game is launching full-screen every time and I do not want that. I can set Screen.FullScreen = false on startup, but it still launches full-screen and then shrinks down, which looks like garbage.

    I'm on a Mac, so no registry keys here. I tried the defaults delete trick to no effect. And my player settings do not have the "Display Resolution Dialog" option:

    upload_2021-1-24_8-18-1.png

    I'm tearing my hair out. Any ideas?
     
  33. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    its a total disaster @JoeStrout

    it is beyond belief that Unity have scrtewed this

    one tip that may or may not help, regarding PLAYER / COMPANY NAME

    just change it slightly. do, I go fattie, fattiex, fattieY, fattie2x etc etc

    do that and build again -it may help

    ALSO ***

    in a recent build we had to "Create Xcode Project" and use the build in there. if you are doing that dont forget that, annoyhingly, you MUST, in the Xcode project, clean and then build again, due to the idiotic way caching works.

    hope it helps somehow
     
  34. jsuarez5341

    jsuarez5341

    Joined:
    Jul 8, 2019
    Posts:
    6
    Just ran into this issue on Linux. The equivalent prefs file to delete in in ~/.config/unity3d/<PROJECT_NAME>

    Edit: It seems this is not enough... deleting the entire .config/unity3d folder resolves the issue
     
    Last edited: Feb 5, 2021
  35. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,482
    Please file a bug report so we can look into this and see if its something we could improve.
     
  36. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,335
    bug #1312398
     
    karl_jones likes this.
  37. BoaNeo

    BoaNeo

    Joined:
    Feb 21, 2013
    Posts:
    56
    This is annoying... Where are these settings even stored? I've cleared player prefs and deleted the application folder in "~/Library" - I deleted the entire project Library folder and forced a complete re-import and re-build. I've changed company name, deleted and renamed the app, and I've restarted Unity numerous times... Nothing works, it just completely ignores the build settings and there is no way to get the game to not launch in fullscreen (Even though it worked fine before I switched to fullscreen).

    Remembering the settings when there is no way to un-remember them qualifies as a bug IMO, not a feature.

    (This is on OsX, Unity 2021.1.15f1)
     
    miracalious and deus0 like this.
  38. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    525
    Try ~/Library/Preferences/com.company.gamename.plist

    Oh, and macOS caches stuff like this so you might find that you have to flush the preferences from the terminal.
     
  39. Moldyboy

    Moldyboy

    Joined:
    Dec 17, 2014
    Posts:
    1
    On Linux, a reliable workaround is
    1. Close the Unity Editor
    2. Delete ~/.config/unity3d/COMPANY_NAME/PRODUCT_NAME/prefs
    3. Open Unity Editor and build
     
    deus0 likes this.
  40. treborguy

    treborguy

    Joined:
    Apr 17, 2014
    Posts:
    30
    If many people are reporting it even in a forum why don't you file the report yourself or just fix it? I know it's easier to have bugs filed for you but sometimes it must just be better for the Unity team to look into things themselves for the sake of their own product, rather than ignoring a decade old bug forum thread until it appears in a report...
     
  41. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,482
    Because we can't always reproduce a bug that's reported on the forum. There's often more to it than a simple description, it could be the way the project is setup, the platform, the combination of packages and versions etc. It also means you can track the bug. If I report it, can't reproduce it and close it as fixed then you have no way to correct it and help us understand why we could not reproduce it. Many people may post on a forum and say they have the same symptoms of a bug but that's doesn't mean they have the same bug.
     
  42. JPMay

    JPMay

    Joined:
    Dec 13, 2021
    Posts:
    6
    it's an unbelievably obvious and straightforward problem.

    it's blatantly obvious in every version and every project

    it's one of the most famous problems in Unity (and that's saying something)

    unity haven't fixed it in 15? (!!) years, they never will
     
  43. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,482
    15 years with no bug report? I'll try and take a look at it next week but if you really want it fixed then filing a bug report is the best way to guarantee it.
     
    Last edited: May 15, 2022
  44. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,741
    I'm actually not sure what THE ISSUE discussed here is. Throughout the thread, people have been complaining about semi-related but actually different Unity player behaviours.

    Let's take a look:

    This is by design. It's not a bug, this is how 99% PC games works.

    This has been fixed a few years ago. If you change player settings and build again, Unity will ignore the saved settings and instead use the ones from Player Settings (but only once - because the defaults changed). Registry clearing is no longer necessary.

    This sounds entirely unrelated to whatever is discussed in the thread.

    This is yet another slightly-different-but-not-the-same issue (the game runs in a resolution that is not "supported"). This one is by design too, as PC games are supposed to work in any resolution because gamers use displays of variety of resolutions (from 1368x768 on cheap laptops, 4k on the high end or even ultra wide). Forcing a specific resolution makes the gaming experience suck.

    While I understand that PC games is not the only thing people use Unity for when building for Windows, it's still the primary use case, so the engine optimizes for that use case. You can force a specific resolution using Screen.SetResolution API call, it's just that 99% of the projects will not want to do that. But the option's there if you want it. You can even recompile the executable and force the startup resolution/fullscreen mode before the game starts.

    This seems like yet another different issue.

    This was fixed but wasn't exactly what others reported in this thread.

    I think it's pretty fair to say that "this problem" is neither obvious nor straightforward.
     
    karl_jones and Ryiah like this.
  45. treborguy

    treborguy

    Joined:
    Apr 17, 2014
    Posts:
    30
    So the problem I had was that even if I set the app to fullscreen the 'remembered' setting would always be windowed mode on launch. This is on 2020.3.29f1. I tried to recreate the bug in a new project but so far I've been unable to and I didn't save a version of the project where the bug was present, so I don't have any helpful details to give in a bug report.

    In the end the thing that fixed it for me was following this post:

    A couple more details. I am using the "resizable window" setting and allowing switching between exclusive fullscreen and windowed in my game's settings.

    In the code I set both Screen.fullscreenmode and Screen.fullscreen each time I switch,
     
    Last edited: May 16, 2022
    tjPark likes this.
  46. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,741
    I don't know exactly what goes wrong with your issue, but just a note: Screen.fullScreenMode superceeded Screen.fullScreen, so you don't need to set both.

    It's interesting that it would remember the wrong fullscreen mode. I wonder, perhaps it was crashing on closing and didn't manage to save setting or something?
     
  47. justin35f

    justin35f

    Joined:
    Jan 19, 2013
    Posts:
    37
    I'm having the same issue. I have a project set up to play in full screen mode via Project Settings -> Player. I build the project and run it. It runs in fullscreen mode as expected. Later I decide I want it to play in window mode, so I make that change in the same location; Project Settings -> Player. I build the project and run it. It runs in fullscreen mode, this is not expected behavior (from a developers standpoint). It seems that when the project is built, the registry key is set only if it is empty. So later builds will not pull in updates to settings. For a game or other application running as a production build, this isn't expected behavior. If the player settings are changed, a user would expect that change to be respected.

    To be clear, there were no crashes or other errors and the application exited successfully when prompted.
     
  48. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,335
    It is not what you want to happen - I added a windowed-mode check and set in the code when this was happening, so if is in fullscreen at start, changes to windowed mode! Might be only way to be sure!
     
  49. tjPark

    tjPark

    Joined:
    Mar 19, 2015
    Posts:
    13
    My customer asked me to set to fullscreen so I checked
    1) set to Exclusive Fullscreen
    2) unchecked Resizable Window
    3) unchecked Allow Fullscreen Switch // I don't know theses matters

    However customer tell me it runs in window mode and I doubted but it actually is. And never goes back as it is registered in Windows Registers & not allowed fullscreen switch = no alt + enter(as customer didn't want to switching(actually to window mode, but it already happend) )

    After checking some, I saw when the app ran twice(2 instances simultaneously), the app goes window mode and its fixed.
     
  50. Edvard-D

    Edvard-D

    Joined:
    Jun 14, 2012
    Posts:
    129
    2023 and I was having this issue. Full screen (as it should've been) on my desktop, windowed on my laptop. Deleting the registry entries did the trick as described here:

     
    Last edited: Mar 6, 2023
    AlphaLulz likes this.