After looking on AnswerHub I found 4 possible ways to set the desired resolution and windowed mode (windowed or fullscreen) for your packaged game:
Create a file DefaultGameUserSettings.ini and put it in your project’s Config directory. Now when you package your game, it will run at the correct resolution (and windowed/fullscreen mode) based on the settings in the .ini file.
(The .ini file seems to be inaccessible after you package the game so the player can’t edit it and tweak the settings. I could be wrong but I didn’t find a way to edit the .ini file after packaging.)
Package the game as you normally would and then manually add a GameUserSettings.ini file to:
(This is a lot like option 1 except now the player can manually edit the .ini file to enter the resolution and windowed mode they want.)
*Sample contents of the .ini file can be found here:
In game menu level blueprint BeginPlay add a “Execute Console Command” node and run a command (for example):
where w is for windowed mode and f is for fullscreen mode.
You can also use command line parameters when you run the game exe (-ResX=1280 -ResY=720 -WINDOWED).
I don’t think any of these is the “right” way to do it. You can allow some combination but ultimately there should be a settings menu in-game that lets the user change these things.
I found this. I think it would be a good place to start. He uses console commands (the video is a bit old) but now there are some new nodes. I know of at least one (“SetOverallScalabilityLevel”). Matt Wadstein has a video on it here and I’m sure he has videos on any other scalability node that is available.
The settings menu would be ideal but I just wanted to set the default res and window mode when the user opens for the first time. I guess there is no “right” way like you said as long as it works. None of the options seems ideal I was just wondering if there was a more or less common way of setting the defaults.
How would you detect the users desktop resolution and set your game to that resolution fullscreened the first time they launch the game, but not overwrite any changes they may have selected in game? For instance, first time they launch the game, it detects 1920x1080 and the game launches at that fullscreen. However, in the game menu they select 960x540 windowed.
I can’t imagine a way for them to launch the game a second time at 960x540 windowed without it automatically launching at 1080p fullscreen then having a blueprint change it to 960x540 windowed.
There are blueprint nodes that you can use to SaveUserSettings. This creates a file in your game folder which you can then read when you start the program. You can save all sorts of things like usernames and passwords - anything you like really.
So, first time you start it does not exist and you invite the user to enter what they want. After that it can be automatically read and then it is up to you to offer the user the chance to update it if they want to - usually by using suitable widgets for the user interface.