Search code examples
c++unreal-engine5

How to log FVector in unreal engine


FVector ActorLocation = GetActorLocation();

UE_LOG(LogTemp, Log, TEXT("Actor location: %f"), ActorLocation);


Solution

  • You can't log an FVector directly. You need to convert it to an FString and then use %s (not %f) and finally operator* for dereferencing.

    This should work

    UE_LOG(LogTemp, Log, TEXT("Actor location: %s"), *ActorLocation.ToString());