Get player number in room with ViewID
Options
I have this code...
Assuming PUN has a reliable list of players that does not change and can be traversed I want to find out what number in that list they are, if that makes sense.
So I have
Player1 VIEWID: 1001
Player2 VIEWID: 2001
Player3 VIEWID: 4001
Player4 VIEWID: 5001
I want to use the ViewID to find out that ViewID 4001 is 3rd in that list. I hope that all makes sense and is easily possible.
Thanks
other.gameObject.GetComponent<PhotonView>().ViewID
Assuming PUN has a reliable list of players that does not change and can be traversed I want to find out what number in that list they are, if that makes sense.
So I have
Player1 VIEWID: 1001
Player2 VIEWID: 2001
Player3 VIEWID: 4001
Player4 VIEWID: 5001
I want to use the ViewID to find out that ViewID 4001 is 3rd in that list. I hope that all makes sense and is easily possible.
Thanks
0
Comments
-
Hi @MomasVII,
Thank you for choosing Photon!
As explained here, the PhotonView ViewID is obtained using the actor number of the actor who instantiated/created it.
PhotonView.CreatorActorNr will give you the actor number.
The creator can be 0 if it's a room object.
The creator can leave the room or be inactive.
However you should be aware of the difference between actor number and player index in the room.1