Hey guys, let me try to keep this short:
In GameMode::BeginPlay in doing the following:
TActorIterator<AContagionPawn> PawnIterator(GetWorld());
for (auto const Pawn = *PawnIterator; PawnIterator; ++PawnIterator)
{
Pawns.Add(Pawn);
}
Where Pawns is an TArray of AContagionPawn.
No matter how I do it, it seems that PawnIterator only gets a single pawn when I actually have two in the scene. What is wrong?
(I’m also seeing an issue when I get two entries from the Iterator, but both of them point to the same pawn)
Now for the longer discussion, you may skip this…
- I do have some suspicions - I’ve read that GameMode runs on the server, and I don’t really know if searching for actors in the game world from it is alright.
- I moved this code around a bit - I’m just trying it on a custom GameState class, which is supposed to run both on server and clients, and now I get the duplicated items issue.