Player Name Blank When Connecting

Options
GWP
GWP
I'm trying to obtain the names of new players that join a room. Despite the client setting its PhotonPlayer's name to something, the player that OnPhotonPlayerConnected provides on the master client always has its name blank, and allProperties contains only one entry: a blank string under key (Byte)255.

What is the proper way to pass other clients' PhotonPlayers' names through, and is there a legend somewhere of what all the byte codes of allProperties indicate?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited August 2016
    Options
    Hi @GWP,

    Please set RoomOptions.publishUserId to true. You can find more information regarding this in this guide.

    If the issue is still there, please tell us which PUN version do you use.
  • GWP
    Options
    Success in doing so after updating from 1.63.

    For clarity, then, does the PhotonPlayer.name field thus serve no practical purpose?

    And why does the guide say:
    Generally, UserIDs, are not intended to be displayed.

    On the contrary, unless you're making Journey, is it not rather common to display the names of everyone in your room?
  • GWP
    Options
    By the way, it works for showing the userId of a client who joined the room I created; when you're the second player that joins, it calls OnPhotonPlayerPropertiesChanged with a player of ID "1" that has both the "name" and "userId" fields blank and also appears in PhotonNetwork.otherPlayers.

    How do you get the names of players in an existing room you join?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    On the contrary, unless you're making Journey, is it not rather common to display the names of everyone in your room?
    Before UserIDs there was only Username or Nickname.
    Now you have both.
    Display Nickname and use UserID internally.

    How do you get the names of players in an existing room you join?
    They should be available in PhotonNetwork.otherPlayers. If not then there might be an issue.