question

shionyorn0202 avatar image
shionyorn0202 asked

How to get PlayerStatistics of specific player searched by PlayFabId?

Hello,

i am new to playfab and wrote down a script like below to get a player statistics.

i know the PlayFabId of players, but i don't know how to put it into the script.

the error says 'GetPlayerStatisticsRequest' does not contain a definition for 'PlayFabId' .

how can i make this work?

PlayFabClientAPI.GetPlayerStatistics(new GetPlayerStatisticsRequest()

{

PlayFabId = pUserID1

}, result =>

{

}, error =>

{

Debug.Log(error.GenerateErrorReport());

});

Player Data
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

Referring to Player Data Management - Get Player Statistics - REST API (PlayFab Client) | Microsoft Docs, ClientGetPlayerStatistics can only get the statistics of the current player. You can call SeverGetPlayerStatistics on the Azure Function Cloud Script, and then the client can call it via ExecuteFunction.

You can also call GetPlayerProfile on the client side, pass in PlayFabId and set ShowStatistics in ProfileConstraints to true to get the statistics of the corresponding player. The premise of this method is that you have checked Statistics in Game Manager->Title settings->Client Profile Options.

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.