Hi [mention removed],
As far as I’m aware, there’s no built-in mechanism in Unreal to initialize the same configuration variable differently based on whether the environment is the Editor or a standalone build. However, there are a couple of effective workarounds you could consider:
1. Editor-specific value using an Editor Module:
You can define an alternative value specifically for use in the Editor. This logic should live inside an Editor Module to ensure it only runs when the Editor is active. For example:
Config:
`[/Script/TPP_554_New.MyTestSettings]
MyValue=42
[TPP_554_New.MyTestSettings.EditorOverrides]
MyValue=999`
C++:
`voidFMyEditorModuleModule::StartupModule()
{
int32 Value = 0;
// Read default value from config
GConfig->GetInt(
TEXT(“/Script/MyProject.MyTestSettings”),
TEXT(“MyValue”),
Value,
GEngineIni
);
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Green, FString("MyNumber: ") + FString::FromInt(Value));
#if WITH_EDITOR
// Override in PIE/editor if override exists
if (GIsEditor && GetWorld() && GetWorld()->WorldType == EWorldType::PIE)
{
int32 EditorOverride;
if (GConfig->GetInt(
TEXT(“TPP_554_New.MyTestSettings.EditorOverrides”),
TEXT(“MyValue”),
EditorOverride,
GEngineIni))
{
Value = EditorOverride;
}
}
#endif
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Green, FString("MyNumber: ") + FString::FromInt(Value));
}`This ensures that your logic only applies in the Editor context, without affecting packaged builds.
2. Separate Editor Config override system:
Another approach would be to create a custom workflow that temporarily overrides configuration values during Editor sessions. For example:
- Maintain a separate EditorConfig.ini with the values you want in the Editor.
- On Editor startup, apply these values programmatically to override the defaults from Engine.ini
- Before packaging or launching in non-editor contexts, restore the original config values to avoid affecting the runtime configuration.
This requires some tooling or scripting, but it gives you more flexibility and clear separation of environment specific settings.
Let me know if either of these solutions could work for your case, or if you’d like assistance implementing them
Best regards,
Joan