- Home /
Launching game in windowed mode by default (problem)
Hi.
I wanted to make a launcher screen, so I disabled the Display Resolution Dialog, and un-ticked the Default Is Full Screen option inside the Player Settings. I went ahead and built the game, launched it, and I noticed that the game was launched in full screen. I reenabled the resolution dialog, and I've seen the Windowed option was not selected. I also tried building to a different file name, as well as building an empty scene with no scripts attached - no luck.
Any tips are welcome.
Answer by LukaKotar · Aug 11, 2014 at 02:54 PM
OK, so I've figured it out, but I forgot to post the answer to this question. So here goes:
By looking through the PlayerPrefs keys (and a bit of messing around with them), I've found that Unity uses the following keys to determine what resolution the game will launch in:
"Screen Manager Resolution Width" - resolution X (int)
"Screen Manager Resolution Height" - resolution Y (int)
"Screenmanager Is Fullscreen mode" - 0 = windowed, 1 = fullscreen (int)
To work around the problem described in the question, set the keys to the desired value when the game quits. I recommend using OnApplicationQuit for the job, as it runs regardless of how the game quits (anything other than a crash).
void OnApplicationQuit () {
PlayerPrefs.SetInt("Screenmanager Resolution Width", 800);
PlayerPrefs.SetInt("Screenmanager Resolution Height", 600);
PlayerPrefs.SetInt("Screenmanager Is Fullscreen mode", 0);
}
Note that you will have to create a new PlayerPrefs key or two to keep track of the users previous resolution. (You don't want your players to have to select the desired resolution every time they open the game.)
Answer by Engelsted · Aug 11, 2014 at 10:16 AM
I had the same problem. I believe that Windows remembers the settings regardless of the dialog box is off if you have already run the application once with the dialog box on.
I fixed this by changing the Product Name in Playersettings and forcing Windows to treat the application as new.
Had the same problem, that fixed it, thanks. Is there, however, any other solution? If I somehow accidentally bump into this problem again, there surely must be other solution than changing the product name.
I know it's an old post, but I encountered the same problem with unity 2019. You can also clear all player pref by going to Edit > Clear All PlayerPref
:)
This will fix the issue. Good effort, been annoying me for a couple of days!
Answer by raannnndommm · Jul 06, 2013 at 06:25 AM
I believe it is a unity problem. Try setting full screen default. P.S "Windowed" means its not full screen.
Answer by Dracorat · Apr 15, 2013 at 11:10 PM
Check all the scripts in the Editor section of your Assets. Editor scripts can alter the default build time settings. There are probably a lot of them, but maybe if you sort (in Windows) by file date you can see some edited more recently.
Look for "fullscreen" and "screen" in them.
I have just checked all the scripts inside Assets/Editor and Assets/Standard Assets/Editor, which are the only places I'd put an editor script. I did not find anything associated with screen or fullscreen in them.
I have the same issue. I looked into the scripts for screen or fullscreen and nothing. Im using Unity 4.2 FREE edition... is that a problem?
Answer by DarkSlash · Sep 23, 2013 at 06:25 PM
Same problem. I removed all references to Screen, but the problem still there. So I put this line in the script of the first scene, and the problem's gone: Screen.fullScreen = false;
Your answer
Follow this Question
Related Questions
Shadows problem with mobile. 1 Answer
Serious tearing issues with an Nvidia card 0 Answers
Werid normal map import issue (Android) 0 Answers
(JS) Touch pause menu issue 1 Answer