Game User Settings doesnt save all changes

Hi there,

We are on Unreal 4.5.

I was looking into why some settings werent being saved out correctly in the game user settings ini and found a bug in engine code.

In UGameUserSettings::ApplySettings the code calls both ApplyResolutionSettings and ApplyNonResolutionSettings.

ApplyResolutionSettings saves the config (it calls SaveSettings) but this happens before the ApplyNonResolutionSettings occurs, so any changes to those are not saved.

The only time ApplyResolutionSettings is called is in ApplySettings so I dont see any reason why the save should be done after everything is done.

The second problem is that UGameUserSettings::SaveSettings() is like this:

	SaveConfig(CPF_Config, *GGameUserSettingsIni);
	Scalability::SaveState(GGameUserSettingsIni);

This means that the scalability settings are set after the config is saved… which means the new values there are not saved out…

To get around this, our choice is to just call SaveSettings manually twice OR call Scalability::SaveState(GGameUserSettingsIni) manually and then SaveSettings…

Is this just an oversight or is there something which could break by doing this?

Thanks for the guidance.

Hi ,

The code you mentioned does look a bit strange. I have reached out to a developer for some clarification regarding the intended functionality here. Unfortunately I don’t expect to receive a response until after the holiday break.

Hey ,

Thanks for bringing this up, I had spotted this just before Christmas and a fix has been made. I’ll see about getting this merged into the 4.7 release.

Hello, I am using the same code as mentioned in the OP, however, even though the changes are being applied to the running game, nothing is written out to a ini file in the packaged game. What do I need to do in order to permanetely write out those GameUserSettings to disk?

Hi ,

If you call SaveConfig on your UGameUserSettings object this will write all the values that differ from the Default hierarchy to a Game/Saved/Config/GameUserSettings.ini file.

Does this file exist for you?

/

I figured out those values that differ are not saved into /Saved/Config/GameUserSettings.ini, but instead that file and folder structure is saved into %LOCALAPPDATA%.

(btw. I am using 4.8.3)

Hi ,

Yes, it could save in there if you have installed the engine through the launcher. Does that file contain the changes to GameUserSettings that you have applied?

/

I have created a file DefaultGameUserSettings.ini, saved in my /Config folder. Then when I package and run the game, all settings that differ from those in the defaults are written into the GameUserSettings.ini file within %LOCALAPPDATA%//…

Hi ,

Yup, that seems right.

/