Accessing a Player by his Actor number
Hallo.
Could someone please make a simple example how to access a player in a room by his Actor number.
I need to check if a Player has left the room.
I was trying something like....
if (PhotonNetwork.PlayerList.ActorNumber[1] == null) { then }
Thanks a lot.
Could someone please make a simple example how to access a player in a room by his Actor number.
I need to check if a Player has left the room.
I was trying something like....
if (PhotonNetwork.PlayerList.ActorNumber[1] == null) { then }
Thanks a lot.
1
Best Answers
-
Hi @Paladin83,
I think you should make use of the callbackIInRoomCallbacks.OnPlayerLeftRoom(otherPlayer)
.
Otherwise, there is a helper methodRoom.GetPlayer(int)
Player player = PhotonNetwork.CurrentRoom.GetPlayer(actorNumber); if (player != null && !player.IsInactive) { // player is joined to the room }
7 -
Thanks a lot.0
Answers
-
Hi @Paladin83,
I think you should make use of the callbackIInRoomCallbacks.OnPlayerLeftRoom(otherPlayer)
.
Otherwise, there is a helper methodRoom.GetPlayer(int)
Player player = PhotonNetwork.CurrentRoom.GetPlayer(actorNumber); if (player != null && !player.IsInactive) { // player is joined to the room }
7 -
Thanks a lot.0