I want to iterate over all actors from a certain class in c++, however the actors have a common BP class parent. Can i iterate over just that BP class type instead of all actors?
e.g.
instead of
for (TActorIterator<MyActorClass> It(GetWorld()); It; ++It)
{
...
}
(see iterator here) . Or use the the GetAllActorsOfClass function to have all found actors stored in an array:
TArray<AActor*> OutActors;
UGameplayStatics::GetAllActorsOfClass(this, MyActorClass::StaticClass(), OutActors);
// e.g. get location of first actor
OutActors[0]->GetActorLocation();