I have a Blueprint EditorUtilityWidget that can update some UDeveloperSettings. My problem is that the changes don’t stick between an editor reload or map change. I can get the changes to apply to the DefaultGame.ini file, as reported by my version control. However, upon a map change or editor restart, the changes in the DefaultGame.ini file will revert.
If, however, I change the same settings in DefaultGame.ini but through the ProjectSettings window, they will persist between a map change or editor restart.
Here is my custom UDeveloperSettings that I am mutating through the BEUW:
UCLASS(Config=Game, DefaultConfig, meta = (DisplayName = "Map Validation Settings"))
class GTMAPVALIDATOREDITOR_API UMapValidationSettings : public UDeveloperSettings
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Config, Category = "Map Validation", meta = (ToolTip = "Define an array of MapTypes here. A MapType defines what types of relevant validation tests it should receive."))
TArray<FString> MapTypes;
UPROPERTY(EditAnywhere, Config, Category = "Map Validation", meta = (ToolTip = "For GT Map Validation to discern what validation tests to use, each packaged map must be associated with a MapType. It's best to not edit these settings here but instead through Tools > GT Map Validation"))
TMap<FString, uint8> FileToMapTypeAssociations;
};
And here is the save function that I’m calling to save the changes.
// Settings are retrieved via
// UMapValidationSettings* Settings = GetMutableDefault<UMapValidationSettings>();
void UMapValidatorWidgetBase::Save(UMapValidationSettings* Settings)
{
// Save all config properties to DefaultGame.ini
Settings->SaveConfig(CPF_Config, *Settings->GetDefaultConfigFilename());
// Force config flush
GConfig->Flush(false, *Settings->GetDefaultConfigFilename());
}
I’ve tried seemingly every combination, but I don’t know where it’s retrieving the initial values to revert to and why it’s doing so.