Yes, intuitively you’d think that when you specify a class, GetAllActorsOfClass should return an array of that class. Actually, if you use a GetAllActorsOfClass node in blueprints, it does return an array of that class, even though I can’t see any Casting or other conversion in the UGameplayStatics::GetAllActorsOfClass code.
I personally just do
TArray<AMyActor*> MyActors;
for (AActor* actor : OutActors)
{
MyActors.Add(Cast<MyActor>(actor));
}
But I’d like to know if it’s possible to get an array of the required class right away, just like you can in blueprints.