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! :)
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! :)
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());
});
}
46 People are following this question.