Hello Epic,
We found that the SetCVar console command is not working as expected when ALLOW_OTHER_PLATFORM_CONFIG is false. When this preprocessor define is true, we can use SetCVar to set a cvar to a specific value and a specific priority, but when ALLOW_OTHER_PLATFORM_CONFIG is false, SetCVar reports “Unable to lookup a CVar value on another platform in this build”. We believe this is a bug in the SetUnsetCVar function in ConsoleManager.cpp, and the end of this function should be as follows:
if (CVar == nullptr)
{
Ar.Logf(TEXT("No CVar named %s"), *CVarName);
return;
}
// get platform version
if (PlatformName.Len())
{
#if ALLOW_OTHER_PLATFORM_CONFIG
CVar = CVar->GetPlatformValueVariable(*PlatformName, *DeviceProfileName).Get();
if (CVar == nullptr)
{
Ar.Logf(TEXT("Failed to get CVar for platform %s"), *PlatformName);
return;
}
#else
Ar.Logf(TEXT("Unable to lookup a CVar value on another platform in this build"));
return;
#endif
}
FString Value;
if (bSet)
{
Value = FParse::Token(Params, false);
}
EConsoleVariableFlags SetBy = ECVF_SetByConsole;
FName Tag = NAME_None;
FString Str;
if (FParse::Value(Params, TEXT("-setby="), Str))
{
SetBy = GetConsoleVariableSetByValue(*Str);
}
if (FParse::Value(Params, TEXT("-tag="), Str))
{
Tag = *Str;
}
if (bSet)
{
CVar->Set(*Value, SetBy, Tag);
}
else
{
CVar->Unset(SetBy, Tag);
}
}
We basically just move the #if line and the #else block of code.
Can you please confirm that this is the expected behavior?