Download

Get Name of an actor

How can i get the name printing in the output log?
I tried this but it didnt work:

Blockquote
.h file:

class abc;

class ADeadlyOrientCharacter : public ACharacter
{
AActor* abc;
}
.cpp file
void ADeadlyOrientCharacter::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("%s", abc->GetName()));
}

UE_LOG(LogTemp, Warning, TEXT("%s", *abc->GetName())); add the * to abc *abc

I think you both are placing a ) in wrong position, it should be TEXT("%s"), so it would look like this:

UE_LOG(LogTemp, Warning, TEXT("%s"), *abc->GetName() );
2 Likes