question

Tanmay Kulkarni avatar image
Tanmay Kulkarni asked

How to update statistics of other account

I have been creating a like system in my game with PlayFab. Each player has a statistic of likes. But when I like some others profile and call the UpdatePlayerstatistics() function, it updates the statistics of current player. I want to update the statistics of other account. The PlayfabClientApi.UpdatePlayerStatistics() doesn't have the parameter of Playfab id

Please Help!

Leaderboards and Statistics
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

·
Seth Du avatar image
Seth Du answered

I am not sure of the detailed scenario, but this kind of work can be done via server API UpdatePlayerStatistics. Though the platform/coding language is not given, to call the Server API, you will require Secret Key for your title, which should never be exposed to the players.

My suggestion is to implement any Server APIs on Cloud Script/Azure function, please refer to: https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript/

3 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.

Tanmay Kulkarni avatar image Tanmay Kulkarni commented ·
@SethDu

Thanks for instant response!

How can I implement that in Unity 3d client

0 Likes 0 ·
Tanmay Kulkarni avatar image Tanmay Kulkarni Tanmay Kulkarni commented ·

@SethDu

Please help

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Tanmay Kulkarni commented ·

Here is Unity sample code, please remember to add your codes in callback result:

 PlayFabClientAPI.UpdatePlayerStatistics(
                    new UpdatePlayerStatisticsRequest {
                        Statistics = new List<StatisticUpdate> {
                            new StatisticUpdate{
                                StatisticName = "xxxx",
                                Value = 123
                            }
                        }
                    },
                    onSuccess=> { },
                    onFailed=> { });

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.