GameplayStatics/GetAllActorsWithInterface

Find all Actors in the world with the specified interface. Include #include "Kismet/GameplayStatics.h" Syntax static void GetAllActorsWithInterface(const UObject* WorldContextObject, TSub...

Updated over 4 years ago Edit Page Revisions

Find all Actors in the world with the specified interface.

Include

#include "Kismet/GameplayStatics.h"

Syntax

static void GetAllActorsWithInterface(const UObject* WorldContextObject, TSubclassOf Interface, TArray& OutActors)

Parameters

WorldContextObject

Any UObject that exists in the world.

Interface

The interface to find.

OutActors

Output array containing actors of the specified interface.

Examples

Real world use cases:

Example 1

TODO: Add more details

TSubclassOf SomeInterface;
...
TArray& OutActors;
UGameplayStatics::GetAllActorsWithInterface(this, SomeInterface, OutActors);
for (AActor* SomeActor : OutActors) {
{
    // Use the found actors
}