question

mikael.lauvlid@hotmail.no avatar image
mikael.lauvlid@hotmail.no asked

How can a member which is not the owner update his lobby member data?

If a member, which is NOT the owner of a lobby, wants to update his own lobby member data, how excactly will he do this? A Unity code example would be nice! :)

multiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Neils Shi avatar image
Neils Shi answered

Please note that lobby owner cannot modify the data of other lobby members, only lobby members can modify their own data. Lobby members have two ways to modify their own data. One is to modify the data when calling the API JoinLobby to join the lobby. The second is that players can call the API UpdateLobby to modify their own data after joining the lobby. You can refer to my testing example code:

 public void JoinLobbyAndUpdateMemberData()
     {
         PlayFabMultiplayerAPI.JoinLobby(new JoinLobbyRequest()
         {
             ConnectionString = " ",
             MemberData = new Dictionary<string, string> { { "MyDataKey", "Test0" } },
             MemberEntity = new PlayFab.MultiplayerModels.EntityKey { Id = "************", Type = "title_player_account" }
         },
     result => Debug.Log("join and update successful"),
     error => {
         Debug.Log("Got error joining and updating");
         Debug.Log(error.GenerateErrorReport());
     });
     }
    
     public void UpdateMemberData()
     {
         PlayFabMultiplayerAPI.UpdateLobby(new UpdateLobbyRequest()
         {
             LobbyId = " ",
             MemberData = new Dictionary<string, string> { { "MyDataKey", "Test1" } },
             MemberEntity = new PlayFab.MultiplayerModels.EntityKey { Id = "************", Type = "title_player_account" }
         },
     result => Debug.Log("update successful"),
     error => {
         Debug.Log("Got error updating");
         Debug.Log(error.GenerateErrorReport());
     });
     }
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.