Total noob here. Should be an easy one.
I am fetching a json string from http, and extracting out a string identifier. This works great.
I want to keep this identifier to use in a later function.
I have extended [project]Character.h and cpp to hold the code and the string, but it’s not working. Blueprints does not need to touch this variable once I have it.
Character.h
FString LeetPlatformId;
Character.cpp
ALEETDEMO2Character::LeetPlatformId = JsonParsed->GetStringField("player_platformid");
UE_LOG(LogTemp, Log, TEXT("ALEETDEMO2Character::LeetPlatformId: %s"), *ALEETDEMO2Character::LeetPlatformId);
LeetPlatformId = JsonParsed->GetStringField("player_platformid");
UE_LOG(LogTemp, Log, TEXT("LeetPlatformId: %s"), *LeetPlatformId);
In the log, I see:
LogTemp: ALEETDEMO2Character::LeetPlatformId: REUFIR
LogTemp: LeetPlatformId: REUFIR
So far so good
But when I try to get this string in a different function:
Character.cpp
UE_LOG(LogTemp, Log, TEXT("LeetPlatformId: %s"), *LeetPlatformId);
UE_LOG(LogTemp, Log, TEXT("ALEETDEMO2Character::LeetPlatformId: %s"), *ALEETDEMO2Character::LeetPlatformId);
This displays:
LogTemp: LeetPlatformId:
LogTemp: ALEETDEMO2Character::LeetPlatformId:
What am I doing wrong?
Thanks so much!