Boolean variable from config file

Hey all. Just wondering how to make a config variable that is a boolean be correctly read in-game. I’ve successfully read strings and number from the config file (DefaultEngine.ini), however I’m struggling with a bool. So far I’ve tried:

[/Game/MyBlueprintClass.MyBlueprintClass_C]
variable=True
variable=true
variable=1

None with any luck.

in c++, you can use GConfig->GetBool(…) and GConfig->SetBool(…)
I don’t have the real syntax this time, but it’s how I get bool var from config files

Accessing the configs through C++ ended up being the easiest method. My implementation looked something like:

void UConfigLibrary::ReadConfigBoolValue(const FString FileNameWithPath, const FString VariableName, bool &value) {
	value = false;
	if (!GConfig) return;

	const TCHAR* path = *FileNameWithPath;
	const TCHAR* name = *VariableName;

	bool ValueReceived = false;
	GConfig->GetBool(
		path,
		name,
		ValueReceived,
		GEngineIni //Reading from DefaultEngine.ini or Engine.ini
		);

	value = ValueReceived;
	return;
}

and the config looking like:

[lanConfig]
bEnabled=False
bIsServer=False
server="192.168.137.250"
1 Like