Compiles fine, but crashes on play - different than other topics!

Not sure why,
but code compiles fine, but crashes on me.

void UPositionReport::BeginPlay()
{
Super::BeginPlay();

// …
FString ObjectName = GetOwner()->GetName();
FVector ObjectTranslation = GetOwner()->GetTransform().GetTranslation();
UE_LOG(LogTemp, Warning, TEXT("%s is at position x:%s y:%s z:%s"), *ObjectName, ObjectTranslation.X, ObjectTranslation.Y, ObjectTranslation.Z);
}

Slightly different approach, but would have thought this works. I will play a bit more, but if somebody has an idea.

Looks like I need to be more careful with floats.
Although it compiles fine C++ doesn’t convert a float just like that into a string (respective FString).

Python got in my way.

Plus, the UE_LOG macro is… fraught. :slight_smile:

Privacy & Terms