Unity PUN 2 不加入房间获取房间玩家数
Unity PUN 2 Get Room Playercount Without Joining The Room
我想在我的房间列表中的每个房间旁边都有一个小玩家数,但是使用 playerCount.text = PhotonNetwork.PlayerList.Length.ToString();
获取玩家数
不会工作,因为它会 return 0 因为你还没有在房间里。
房间有 PlayerCount 属性
byte
PlayerCount
[get] The count of players in this Room (using this.Players.Count)
但是,它似乎与上面引用的 Players
属性 (using this.Players.Count
) 冲突。
Dictionary<int, Player>
Players
[get] While inside a Room
, this is the list of players who are also in that room.
我希望 thisRoom.PlayerCount
能按预期工作,即使文档似乎另有说明。
我想在我的房间列表中的每个房间旁边都有一个小玩家数,但是使用 playerCount.text = PhotonNetwork.PlayerList.Length.ToString();
获取玩家数
不会工作,因为它会 return 0 因为你还没有在房间里。
房间有 PlayerCount 属性
byte
PlayerCount
[get] The count of players in this Room (using this.Players.Count)
但是,它似乎与上面引用的 Players
属性 (using this.Players.Count
) 冲突。
Dictionary<int, Player>
Players
[get]While inside a Room
, this is the list of players who are also in that room.
我希望 thisRoom.PlayerCount
能按预期工作,即使文档似乎另有说明。