Understanding GameUserSettings and the .ini file

Some interesting behaviour with GameUserSettings. When launching as a standalone game from the Editor, the game starts in windowed mode. Pressing on a button on screen which executes the following code, the game switches to fullscreen mode

UGameUserSettings::GetGameUserSettings()->ApplySettings(false);
UGameUserSettings::GetGameUserSettings()->SaveSettings();

No other call to any resolution or window settings are made.

Previously unedited (probably) GameUserSettings.ini has this content:

[/Script/Engine.GameUserSettings]
bUseVSync=False
bUseDynamicResolution=False
ResolutionSizeX=2304
ResolutionSizeY=1440
LastUserConfirmedResolutionSizeX=2560
LastUserConfirmedResolutionSizeY=1440
WindowPosX=-1
WindowPosY=-1
FullscreenMode=0
LastConfirmedFullscreenMode=1
PreferredFullscreenMode=0
...
  1. Why did the game start in windowed mode?
  2. Why did just applying settings trigger fullscreen mode?
  3. Is this .ini file meant to be edited by hand?
  4. What is the correct way to ensure the game starts in the correct fullscreen/windowed mode and does not apply some invisible settings when they have not been explicitly set by the developer in code?

When launched in PIE mode (playing in the editor window itself), the config file used is Saved/Config/MacEditor/GameUserSettings.ini.

Changing the resolution and fullscreen mode has no effect but the data is loaded from this file and written to it when LoadSettings and SaveSettings are used.

When launched in Standalone mode, the config file used is Engine/Binaries/Mac/PIEGameUserSettings0 (note the lack of extension). As it’s part of the engine, it should not be manually edited for projects.

I hope this will be useful to whoever runs into the same issue.

It’s still unclear how to change it or override it as the configuration file system documentation is just as good as for other things.