How to save custom user settings to Game.ini or similar?

you can use this setup:

// MySettings.h - header file with custom settings, for ex: MyCustomString

#pragma once

#include "CoreMinimal.h"
#include "Engine/DeveloperSettings.h"
#include "MySettings.generated.h"

class VR_GRAPHS_API UMySettings : public UDeveloperSettings
	UPROPERTY(config, EditAnywhere)
	FString MyCustomString;

later you can use this settings in your custom class:

#include "MySettings.h"

void USomeClass::UseSomeSettings()
    const UMySettings* MySettings = GetDefault<UMySettings>();
	StringFromSettings = MySettings->MyCustomString;	

but keep in mind: after your project packaged there are no files with settings. Run it once and it will be appear: YourProject\YourProject\Saved\Config\WindowsNoEditor\MySettings.ini .
Also it will be empty and it will be use default value (if you set it in the editor or in UMySettings class or in YourSourceProject/Config/DefaultMySettings.ini), but user can easily add two lines in this file for override it:


I am looking into how to save some custom settings to Game.ini so that the user may be able to go into it and change it later in the future. I’m not looking to support changing it at run time but, maybe exposing a variable or something that can be overridden or something similar.

At first I used the UDeveloperSettings but, that seems to only be able to work with the DefaultGame.ini which isn’t visible on the user’s end. Is there a way to use this in order to expose it to Game.ini? Or do I need to take a different approach altogether?

You can also Tick an Option for regular blueprint variables to make Them overridable via the ini File. That integrates quite well. I’m Not in the PC but If you select a variable you can find it in its settings in the right