Hi guys, I have a problem with a foreach bucle I made, this is the code:
foreach (Photon.Realtime.Player Player in PhotonNetwork.PlayerList)
{
int GameCount = (int)PhotonNetwork.LocalPlayer.CustomProperties["GameCount"];
UnorderedList.Add(GameCount);
print("Player");
}
So, in theory, as the documentation says, this PhotonNetwork.PlayerList property has inside, all the players In the room.
So, by following this logic, this foreach should repeat 2 times if there are 2 players, if there are only 4 players, the loop should repeat 4 times, right?
But this is not happening, it repeats A LOT of times, as you can see I have a print line, this message printed 70 times in the console, meaning that the loop repeated 70 times until I stopped the debug.
This is giving me wrong values, does someone know why is this happening and how can I fix it?