I have a PlayerControl.cpp which derives from Pawn class
In that class , I have a method to get all Actors in Map
TSubclassOf<AEnemy> ClassToFind;
TArray<AActor*> FoundEnemies;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), ClassToFind, FoundEnemies);
But FoundEnemies array is always empty , When I do the same thing in BP it works.
Can someone tell me why is this not working in C++ ?
Or If I am doing wrong , How to do it correct ?