RealDocs

UGameplayStatics::GetAllActorsWithTag

function Engine Blueprint Since 4.0
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticBlueprintCallable

Description

Populates OutActors with every actor in the world that has the given tag in its Tags array. Searches across all actor classes.

Caveats & Gotchas

  • Iterates all world actors on every call — same O(n) performance caveat as GetAllActorsOfClass. Cache the result; refresh only when the actor roster meaningfully changes.
  • Tags are actor-level tags (AActor::Tags), not component tags or GameplayTags. A component's tags are not searched here.
  • Tag comparison is case-sensitive (FName comparison). 'Enemy' and 'enemy' will not match.

Signature

static ENGINE_API void GetAllActorsWithTag(const UObject* WorldContextObject, FName Tag, TArray<AActor*>& OutActors);

Parameters

Name Type Description Default
WorldContextObject const UObject* Object used to retrieve the world context.
Tag FName The actor tag to search for. Must be non-None or the output array will be empty.
OutActors TArray<AActor*>& Output array of actors that have the specified tag.

Return Type

void

Example

Destroy all actors tagged as temporary C++
TArray<AActor*> Temporaries;
UGameplayStatics::GetAllActorsWithTag(this, FName("Temporary"), Temporaries);
for (AActor* A : Temporaries)
{
    A->Destroy();
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.