player.name is renamed to Guest xxxx?
It it correct that if a player's name is not unique in the room, it gets renamed by Photon to "Guest xxxx"? I have seen that happen and it's not documented, so just wanting to confirm I understand what's going on . thanks.
0
Comments
why does the masterClient receive the OnPhotonPlayerConnected event for a new player named "Guest (int)" ?
I want to encode some info in a json string in the player name, but photon keeps renaming the player to Guest (int).
Thanks- hopefully just confused here.
You got all code of PUN. It's in there somewhere. Search for "Guest" and find it in the PhotonNetwork constructor.
In there, the re-naming is plain wrong and should be replaced with string.Empty. This sets the name (until otherwise set) to "". This is what the next update of PUN will do but it's maybe not cause for your issue.
There is another place in a demo "MainMenu" Awake. Again, the name is set to "Guest" and a random number. Most likely this is where your name is re-set again.
Speaking of PUN 1.8, and player names, is there any metadata/properties support for players now? Another thread was saying that was going to get rewritten or something? I want to stuff a permanent unique id string into the photon player, but encoding json into the photon player name is perhaps not the best way to do it.
edit: actually never mind about that. I realized that since PhotonMessageInfo has the photonplayer sender, it's easy to make an RPC saying "here is my player metadata".
Using RPCs is a much better way to send the unique ID than encoding it into the name.
Make the RPC buffered and it gets sent to players when they join, too.