PlayerRoomIndexing.cs utility script
Options
I am needing to identify players using the PlayerRoomIndexing.cs script for the classic version. I have attached the script to an empty game object in my scene, and from the scene view everything seems to work behind the scenes fine. But I need to find a way to check what player index each player has. I'm slightly confused as how it all works. How can I reference the player room indexing script (particularly the player index itself) in other scripts I have written.
For example, I need to say: if ( player index = 1){//then do this} (I know that isn't the right way to write it but could you please tell me what the right way is?
Thank you
For example, I need to say: if ( player index = 1){//then do this} (I know that isn't the right way to write it but could you please tell me what the right way is?
Thank you
0
Comments
-
Hi @eel_eye_jar,
Thank you for choosing Photon!
You need to use player.GetPlayerNumber() to get player index/number, do not forget to add "using Photon.Pun.UtilityScripts;" on top of the file.1 -
Thank you so much!
0 -
I just wanted to say JohnTube, your help here is amazing! I really appreciate it
0 -
Also, when I use Photon.Pun.UtilitySpcript ‘Pun’ is an error.
0 -
when I use Photon.Pun.UtilitySpcript ‘Pun’ is an error.
I see now.
PlayerRoomIndexing is PUN Classic indeed.
I thought you're using PlayerNumbering from PUN 2, my bad.
Can you migrate to PUN 2?
PlayerRoomIndexing namespace is ExitGames.UtilityScripts.
the extension method is photonPlayer.GetRoomIndex();1 -
My script does not recognise ‘photonPlayer’
0 -
Nevermind I have sorted it
0 -
How would I say ‘if photonPlayer.GetRoomIndex == 1’
0 -
Bump0
-
Bump @JohnTube0
-
Did you migrate to PUN 2?
And please ask questions with intention. Let us know what you want to achieve, not the code that does not get you there.1 -
No I have not migrated to pun 2. Do I need to? I want to achieve an if system where I can check what index number you are. Thank you0
-
I am trying to create a system that says, if the players index is x, then do this. How can I check what index the local player has? Sorry if it seems like I'm being a tad annoying, I've been trying to fix this for a good couple of months now. Thank you.0