RealDocs

AActor::GetActorLabelView

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

Description

Returns a non-owning view into the actor's editor label string without allocating. Returns an empty view in shipping builds or when no label has been set.

Caveats & Gotchas

  • FStringView does not own the underlying memory — it is only valid as long as the actor (and its ActorLabel field) remains alive. Never store the view past a frame boundary or after any operation that could trigger a garbage collection.
  • In configurations where ACTOR_HAS_LABELS is not defined (standard shipping), this always returns an empty FStringView. Use GetActorNameOrLabel() if you need a guaranteed non-empty fallback.

Signature

FStringView GetActorLabelView() const

Return Type

FStringView

Example

Zero-copy label comparison in a hot loop C++
FStringView TargetLabel = TEXT("BossSpawnPoint");
for (AActor* Actor : AllActors)
{
    if (Actor->GetActorLabelView() == TargetLabel)
    {
        BossSpawnPoint = Actor;
        break;
    }
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable
5.1 stable Introduced alongside GetActorNameOrLabel for zero-copy access.

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.