Alternative way to use GetNumPawns()?
GetNumPawns() is deprecated since 4.23. What is the proper way to implement the same logic?
int32 UWorld::GetNumPawns() const
{
int32 NumPawns = 0;
for (APawn* Pawn : TActorRange<APawn>(const_cast<UWorld*>(this))) // For backwards compat GetNumPawns needs to remain const, but TActorRange can't use a const UWorld.
{
++NumPawns;
}
return NumPawns;
}