How to identify our own player ?
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
How to identify our own player ?
Steve
2020-04-13 11:50:54
I need to indentify each players because I want to Initialise each Player in a different location. I tried to use the LocalPlayer but when I look into the LocalPlayer, every player has the same UserID, ActorNumber, NickName etc...
I also tried the PlayerNumbering, it doesn't seem to work either. I didn't find any other informations in the documentation.
Comments
Hi @Steve,
Thank you for choosing Photon!
Player.IsLocal
PhotonView.IsMine
PhotonNetwork.LocalPlayer
I tried to use the LocalPlayer but when I look into the LocalPlayer, every player has
Why do you need to look at every player if you have LocalPlayer? LocalPlayer is a single unique player not many.
every player has the same UserID, ActorNumber
This is not possible in the same room.
I think maybe the issue you are having is that you are testing on different clients and clients are joined to different rooms. If it's the case make sure clients are joined to the same room. See "Matchmaking Checklist". If it's not the case then there is something wrong with your code and share your snippet here and what you have tried exactly + PUN version.
Before connecting to the Photon servers, set the value of PhotonNetwork.NickName to some random string.
Once you joined a room, check PhotonNetwork.PlayerList to see which players are in that room.
Back to top