// Config tag can be added to any UCLASS
UCLASS(BlueprintReadOnly, Config=MyConfigFile)
class PROJECT_API MyNewClass : public AActor
{
GENERATED_BODY()
public:
MyNewClass ();
// This will create/read the config file
UPROPERTY(Config, BlueprintReadWrite, EditAnywhere)
FString MySavedVarToConfigFile = "DefaultValue";
//From anywhere inside your class, will generate [YourProject]/Saved/Config/Windows/MyConfigFile.ini
//SaveConfig();
}
You can then create a config file at [YourProject]/Config/DefaultMyConfigFile.ini and add in :
[/Script/PROJECT.MyNewClass]
MySavedVarToConfigFile = "Edited var"
Reboot Unreal Engine if you modify it or manually use a LoadConfig(); when needed.
You can add a SaveConfig(); in your constructor so Unreal will generate the Config file for you. Just need to retrieve it from [YourProject]/Saved/Config/Windows/MyConfigFile.ini and modify ! Think to delete the saved config file so Unreal read again the DefaultMyConfigFile.ini in editor.
Default config files will be automatically added to your package.
Reads More :
Leave a Reply