GameplayStatics/GetAllActorsOfClassWithTag
Find all Actors in the world of the specified class with the specified tag. Include #include "Kismet/GameplayStatics.h" Syntax static void GetAllActorsOfClassWithTag(const UObject* WorldC...
Find all Actors in the world of the specified class with the specified tag.
Include
#include "Kismet/GameplayStatics.h"
Syntax
static void GetAllActorsOfClassWithTag(const UObject* WorldContextObject, TSubclassOf ActorClass, FName Tag, TArray& OutActors)
Parameters
WorldContextObject
Any UObject that exists in the world.
ActorClass
The class of actor which you want to find.
Tag
The tag of actor which you want to find.
OutActors
Output array containing actors with the specified class and tag.
Examples
Real world use cases:
Example 1
TODO: Add more details
TSubclassOf SomeActorClass;
FName SomeTag;
...
TArray& OutActors;
UGameplayStatics::GetAllActorsOfClassWithTag(this, SomeActorClass, SomeTag, OutActors)
for (AActor* SomeActor : OutActors) {
{
// Use the found actors
}