question

Mohsen Jamali avatar image
Mohsen Jamali asked

Can't change group role with master player account ID

I'm getting this error when changing the player role

/Group/ChangeMemberRole: Unable to move the following entities from the origin role because they are not members of the role:

This is my code:

        public PlayFab.GroupsModels.EntityKey EntityKeyMaker(string entityId, string type="group")
        {
            return new PlayFab.GroupsModels.EntityKey { Id = entityId , Type = type};
        }        
        public void PromotePlayer(string player_id)
        {
                var entityKey = EntityKeyMaker(player_id, "master_player_account");
                var request = new ChangeMemberRoleRequest{
                    Group = MyGroupEntity,
                    Members = new List<PlayFab.GroupsModels.EntityKey> { entityKey },
                    DestinationRoleId = "admins",
                    OriginRoleId = "members",
                };
                PlayFabGroupsAPI.ChangeMemberRole(request, result => 
                {
                    Debug.Log($"Successfully changed role {player_id}");
                }, error => {
                    Debug.LogError("Something went wrong");
                });
        }

player_id => master player ID

When I change

var entityKey = EntityKeyMaker(player_id, "master_player_account");
to
var entityKey = EntityKeyMaker(player_title_id, "title_player_account");

It works.

Is there any reason that it doesn't work for master player ID

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

The reason why you encountered this error is because only entities of type title_player_account and character can be added to groups, so when you change group role with master player account ID, it will show they are not members of the role. For your case, please use the title_player_account to change the role.

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.