How to permanently save the GameUserSettings (like resolution) in packaged game?

So in UE4.8.3 I am using the following C++ functions to change some screen settings, like resolution and fullscreen/windowed mode:

Settings->RequestResolutionChange(Width, Height, WindowMode, false);
Settings->ConfirmVideoMode();
Settings->SetScreenResolution(Settings->GetLastConfirmedScreenResolution());
Settings->SetFullscreenMode(Settings->GetLastConfirmedFullscreenMode());
Settings->SaveSettings();

This works for the running game, i.e. after calling these functions the screen is correctly set to the desired resolution etc. However, none of these settings are being written to a config (ini) file. In fact, there is no such ini file at all in the packaged game.

I found the ini file to be saved in the following folder: %LOCALAPPDATA%//Saved/Config/WindowsNoEditor/GameUserSettings.ini. However, after calling the C++ code shown above, this ini file becomes completely empty, no settings there. So after starting the packaged game again, obviously no settings set the last time are used (as the ini file is empty).

I am totally out of ideas now
Could someone please explain to me what I am doing wrong, and what I need to do in order to get this to work?

Hi Haimat,

That ini will be empty if the settings match the default values.

So, to me, it looks like your new resolution just hasnt changed.

Can you inspect the Settings->GetLastConfirmedScreenResolution() function to ensure it has your new value, also, it is worth calling ApplySettings as opposed to SaveSettings as this will update vars internally too.

/Terence

… btw Ill answer your other thread.

So it turned out that calling RequestResolutionChange() is not enough. That does change the current resolution, but it does not save that internally. Only after calling SetScreenResolution() followed by SaveSettings() those new settings are being saved to the .ini file …