RealDocs

AActor::GetActorNameOrLabel

function Engine Since 5.1
#include "GameFramework/Actor.h"
Access: public Specifiers: const

Description

Returns the actor's editor label if one has been set, otherwise falls back to the actor's internal object name. Useful for logging and debug UI that should prefer human-readable labels.

Caveats & Gotchas

  • In shipping builds or when the ACTOR_HAS_LABELS preprocessor flag is absent, ActorLabel is unavailable and this function always returns GetName(). Do not use this for gameplay logic that needs a stable identifier — use GetFName() or the actor's tag instead.
  • The returned string allocates a new FString on every call. For tight loops, prefer GetActorLabelView() which returns a zero-copy FStringView.

Signature

FString GetActorNameOrLabel() const

Return Type

FString

Example

Log a human-readable actor identifier C++
UE_LOG(LogGame, Log, TEXT("Processing actor: %s"), *MyActor->GetActorNameOrLabel());

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable
5.1 stable Introduced as a portable alternative to the editor-only GetActorLabel().

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.