Custom INI parameters

Hello everyone Please tell me how to add a custom parameter to the “Game User Settings.ini” file? For example:

ResolutionSizeX=1920
ResolutionSizeY=1080
bUseVSync=False

Music Volume = 0.75 // Custom param

And please tell me, is this done in C++ or BP?

Can an existing INI file be used as a NewConfigFileName?

Well that’s the same macro that is used in the unreal classes
example
UCLASS(config=Engine, defaultconfig, meta=(DisplayName=“Control Rig”))

or

UCLASS(config=Engine, Blueprintable, editinlinenew)

the key seems to have the correct uproperty markup

UPROPERTY(config)

for the game config I believe it’s

UCLASS(config=Game, defaultconfig)

It’s probably a stupid question, but I’m going to ask it anyway… Can I write/read custom parameters via BP? I will create a CPP class using your method that you wrote above, and then via BP I will call GetGameUserSettings->Apply Settings or SaveSettings (it doesn’t matter). Will my custom parameters be saved/applied?

TBH I’m not sure it will work by default.

You may need to extend UGameUserSettings perhaps overriding ApplySettings, and probably cast to your custom extended GameUserSettings (that’s at least what I’d do)

Thank you very much for telling me in which direction to move!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.