Not receiving Player custom properties with the player join event

Options

I want to send the name of the player with the room join event so that when network users receive this player join event, they can take out the name of the player.

So I'm adding player custom properties in the EnterRoomParams as:

EnterRoomParams enterRoomParams = new EnterRoomParams();

...

var propertiesToSet = new ExitGames.Client.Photon.Hashtable();

propertiesToSet.Add(PhotonPlayerPropertiesExtensions.PropertyKey_UserName, PlayerLocalInformation.UserDisplayName);

enterRoomParams.PlayerProperties = propertiesToSet;

I send this player properties with the OpJoinOrCreateRoom() and make sure it gets through till SendOperation() is called.

What I expect is to receive this player properties in the join event (Loadbalancingclient -> OnEvent() -> case Join). Except that I don't receive it. What am I doing wrong?

Any help is much appreciated

Best Answer

  • Tobias
    Tobias admin
    Answer ✓
    Options

    Is the PropertyKey_UserName a string? Custom Properties are limited to strings.

    You should possibly change the LocalPlayer properties via SetCustomProperties() instead. I don't recall if this is maybe what's sent to the Game Server.

    Also: Use the Player.NickName. If you would want the UserID as well, you don't want to rely on the clients, which could cheat (and thus spoof accounts easily). Use RoomOptions.PublishUserId instead.

Answers

  • Tobias
    Tobias admin
    Answer ✓
    Options

    Is the PropertyKey_UserName a string? Custom Properties are limited to strings.

    You should possibly change the LocalPlayer properties via SetCustomProperties() instead. I don't recall if this is maybe what's sent to the Game Server.

    Also: Use the Player.NickName. If you would want the UserID as well, you don't want to rely on the clients, which could cheat (and thus spoof accounts easily). Use RoomOptions.PublishUserId instead.