Help with displaying player names in lobby room
Options
Jacob
✭
Hi!
I'm having a problem with my code, i was trying to follow this tutorial. The code for displaying the players names in the rooms doesn't work, here is the code,
Any help would be greatly appreciated, Thanks!
I'm having a problem with my code, i was trying to follow this tutorial. The code for displaying the players names in the rooms doesn't work, here is the code,
foreach (Player player in PhotonNetwork.PlayerList) //loop through each player and create a player listing { GameObject tempListing = Instantiate(playerListingPrefab, playersContainer); Text tempText = tempListing.transform.GetChild(0).GetComponent<Text>(); tempText.text = PhotonNetwork.NickName; }and the error is " Assets/Scripts/Photon/CustomMatchmakingRoomController.cs(40,49): error CS0030: Cannot convert type `Photon.Realtime.Player' to `Player' " (Talking about this line of code 'foreach (Player player in PhotonNetwork.PlayerList)')
Any help would be greatly appreciated, Thanks!
0
Comments
-
Hi @Jacob,
Thank you for choosing Photon!
There is another class with the same name "Player" on your project.
There are three solutions:
1.foreach (var player in PhotonNetwork.PlayerList) //loop through each player and create a player
2.foreach (Photon.Realtime.Player player in PhotonNetwork.PlayerList) //loop through each player and create a player
3.using Player = Photon.Realtime.Player;
on top
0