Hello,
I have found that if I delete a player from the game, every shared group that the player was in behaves weird in Shared Group Data. Here's the steps to reproduce it:
- First I create a shared group, add some members and create new data in the group by using the code below:
handlers.TestFunc = function(args, context) { // Create a group var createGroup = { "SharedGroupId": "MyCrew3" }; server.CreateSharedGroup(createGroup); // Add some members to the group var addMembers = { "PlayFabIds": ["107C16C4849CBDB0", "563708E09EAA2411", "422090C61E0E393C"], "SharedGroupId": "MyCrew3" }; server.AddSharedGroupMembers(addMembers); // Add a new data to the group var updateGroupData = { "SharedGroupId": "MyCrew3", "Data": { "TestKey": 1 }, "Permission": "Private" }; server.UpdateSharedGroupData(updateGroupData); return 1; };
In GameManager, everything looks normal.
- I delete a player who is in the group by using the code below.
handlers.TestFunc2 = function(args, context) { // Delete player var deletePlayer = { "PlayFabId": "563708E09EAA2411" }; server.DeletePlayer(deletePlayer); return 1; };
I refresh the page and search the group again, and GameManager behaves weirdly. It doesn't show any members and the Members section changes. It now shows Owner column. Also, the Data section looks weird too. Here's the result:
I use the code down below to get the shared group data in order to see if the player is still in the group
handlers.TestFunc3 = function(args, context) { // Get group data var getGroup = { "SharedGroupId": "MyCrew3", "GetMembers": true, "Keys": ["TestKey"] }; var result = server.GetSharedGroupData(getGroup); return { "Members": result.Members, "TestKey": result.Data["TestKey"].Value }; }
It shows that the player is still in the group. I think, that causes the problem.
(I reached the attachment limit, so here's the screenshot of the result: https://i.ibb.co/tJpRGKL/03.jpg )
- I use the code down below to delete the player from the shared group to see if it will work normally again.
handlers.TestFunc4 = function(args, context) { var removePlayer = { "PlayFabIds": ["563708E09EAA2411"], "SharedGroupId": "MyCrew3" }; server.RemoveSharedGroupMembers(removePlayer); return 1; }
I refresh the page and search the group, and everything turns back to normal.
(Screenshot link: https://i.ibb.co/18ymYDJ/04.jpg )
So, this means that if I want to delete a player, I need to delete the player from all the shared groups that they were in as well. In my case, this never happens to me if I setup everything correctly, but a fix would be great too, at least a warning message showing that a member was deleted.