- Home /
Photon unity networking, all players in lobby
enter code here
Hi guys, so I have this problem, I want to display all players in the lobby, but for some reason I can not get my code to work :( can anyone please help, I am sure I'm making a very stupid mistake. Here is my code
foreach( PhotonPlayer Pplayers in PhotonNetwork.playerList)
{
GUILayout.Label(Pplayers.name);
}
For some reason it just does not want to work???
Sorry guys xx it was something stupid. I did not assign the player's PhotonNetwork.player.name, all fixed :))
Answer by tobiass · Aug 05, 2015 at 08:45 AM
The PhotonNetwork.playerList is only available while in a room, not in the lobby (now better described in the API reference).
The clients don't get a list of players looking for a game. This could be thousands potentially, which is too much to list (and too much to digest as user!).
In a lobby, you can get the count of users looking for games: PhotonNetwork.countOfPlayersOnMaster. You can also show how many games there are: PhotonNetwork.countOfRooms (even without entering the lobby, which gets you the rooms list).
Poor excuse for lack of functionality. Took me 5 hours to stumble upon this answer, maybe should be documented. I am glad we can at least get a player count though, I will just print out my player list with generic names such as "player9999" which stinks but hey, since exitgames thought it was a great idea to skip work this day, it will have to do. @tobiass - "and too much to digest as user!" seriously you don't know what information our users want, need, or can 'digest' so how about more functionality and less fascism?
@BadSeedProductions listing thousands and thousands of games would be stupid. How slow would that be? It would be a waste of resources if they did add that.
Your answer
