For the love of all the gods, can someone tell me what’s going on here.
I’m trying to get a console variable parameter based on a string value contained in a struct. So I have a struct called FCommandData which has an FString member Command. If I try to use that FString, it doesn’t get the correct value of the console parameter. If I use an FString manually defined to be the same value, then it works. Here’s some testing code:
FString CommandString1 = CommandData->Command;
FString CommandString2 = "a.AnimNode.LegIK.Enable";
if (CommandString1 == CommandString2)
{
UE_LOG(LogTemp, Warning, TEXT("Strings are the same."));
}
static const auto CVar1 = IConsoleManager::Get().FindConsoleVariable(*CommandString1);
int32 Value1 = CVar1->GetInt();
UE_LOG(LogTemp, Warning, TEXT("%s: %i"), *CommandString1, Value1);
static const auto CVar2 = IConsoleManager::Get().FindConsoleVariable(*CommandString2);
int32 Value2 = CVar2->GetInt();
UE_LOG(LogTemp, Warning, TEXT("%s: %i"), *CommandString2, Value2);
And here’s the output:
LogTemp: Warning: Strings are the same.
LogTemp: Warning: a.AnimNode.LegIK.Enable: 0
LogTemp: Warning: a.AnimNode.LegIK.Enable: 1
As you can see, the string values are the same. The correct value is 1 in this instance. As you can see, the manually defined FString gets that value, but the other version does not.
WHAT IS GOING ON HERE?!