Actor Number
Options
Hello everyone,
I want to get list of players Respectively (Who Comes first, who comes second, ...), then I use PhotonNetwork.ActorNumber. but i notice that when there is no person in room and just one person enter room and leave the room, number of actor is 1(and this is correct) but (when there is two user in a room) another person from other pc joins the room and leave and again join the room, Actor number doesnt decrease and always increase. is this a bug? or is there any other solution?
Thanks
I want to get list of players Respectively (Who Comes first, who comes second, ...), then I use PhotonNetwork.ActorNumber. but i notice that when there is no person in room and just one person enter room and leave the room, number of actor is 1(and this is correct) but (when there is two user in a room) another person from other pc joins the room and leave and again join the room, Actor number doesnt decrease and always increase. is this a bug? or is there any other solution?
Thanks
0
Comments
-
What are you using to get this "Actor Number"?
When a new player joins, they are given a new number, and numbers are not recycled.
So if player 1 forms a room, and player 2 joins.... then player 2 leaves...
the next person who joins will be given Actor Id of 3.
It isn't meant as a player count, it is just a unique id for each player that has joined.0 -
I've run into this issue. I found the script you referenced above @JohnTube , but I'm not sure how to implement it. Do I just put it on the component running the room? Thanks
0 -
Hi @SceneOfAction,
Thank you for choosing Photon!
Yes add the component to a GameObject in the scene preferably a one marked with DontDestroyOnLoad.
Or make use it exists as long as a player is in a room.
To use it you need to make use of extension method:
Player.GetPlayerNumber()
.0 -
Sorry for opening this ticket back up. But this 'Player.GetPlayerNumber()' is not working anymore in 2023. Or am I wrong?
EDIT:
PhotonNetwork.LocalPlayer.GetPlayerNumber()
Gives me -1
0 -
It is -1 if you are not in a room. It should be 1 and up, once you joined / created a room.
0