question

c-ming2004 avatar image
c-ming2004 asked

How to remove friend from friend list each other

In my code,

A remove B

In A friend list, B is removed

In B friend list, A is still here

I want to do:

A remove B

In A friend list, B is removed

In B friend list, A is removed

The code is shown as below. Thanks.

    private void HandleRemoveFriend(string name){
        string id = friends.FirstOrDefault(f =>f.TitleDisplayName == name).FriendPlayFabId;
        var request = new RemoveFriendRequest{
            FriendPlayFabId = id};
        PlayFabClientAPI.RemoveFriend(request, OnFriendRemoveSuccess, OnFailure);
    }
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

·
Made Wang avatar image
Made Wang answered

To clarify, the APIs for adding friends and removing friends in PlayFab are one-way, so you need to let players call RemoveFriend individually, or you can customize a function that calls RemoveFriend twice on the server side.

2 comments
10 |1200

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

c-ming2004 avatar image c-ming2004 commented ·

Sorry, I am new in Playfab and Unity.

Where can I customize a function on server side. Thanks

0 Likes 0 ·
Made Wang avatar image Made Wang c-ming2004 commented ·

You can write CloudScript on AzureFunction to implement this feature, refer to PlayFab CloudScript using Azure Functions Quickstart Guide - PlayFab | Microsoft Docs to complete the necessary environment configuration and try to implement it.

You can also implement it on your own server.

0 Likes 0 ·

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.