Hi everyone,
I completed the challenge successfully with this line of code:
FString ObjectPosition = GetOwner()->AActor::GetActorLocation().FVector::ToString();
There’s a bit in there that Mike didn’t include in his code, though it returned the same result. I added the AActor:: and FVector:: portions because that’s what I saw in the documentation here. Were those not required because the objects that were being operated on were an AActor and FVector, respectively, and the IDE/compiler used that context to figure out what fucntion to call? How could I tell in the future whether I need to call a function with that level of specificity? Would the code just fail to compile if I tried running GetActorLocation on an object that wasn’t an AActor?
I also added
#include "Math/Vector.h"
to the cpp as it was listed as an include on the doc page for FVector::ToString, but again, Mike didn’t do that and his code worked the same. What’s the best way to check to see if something is already included in another header, as it must be in this case?
Thanks!