player.name is renamed to Guest xxxx?

Options
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.

Comments

  • Or, to be more specific, if I'm setting the player name before connecting to Photon,

    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.
  • Hmm, setting the name after connecting to photon, but before any other photon events seems to work though. :D
  • Tobias
    Options
    I hope you didn't spend all those hours on this topic :)

    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.
  • Tobias, thanks OK thanks for the tips & encouragement I will try to remember to dig into source code next time. I saw there was a .dll too, so I wasn't sure how much is actually exposed in the .cs code.

    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".
  • Tobias
    Options
    v1.8 is more or less a bugfix release, so no properties yet, sorry.

    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.