question

Star Ludo avatar image
Star Ludo asked

UpdatePlayerStatisticsRequest' does not contain a definition for 'PlayFabId','UpdatePlayerStatisticsRequest' does not contain a definition for 'PlayFabId'

I am getting that error while showing player Title data using their playfab ID through server API call

public void UpdatePlayerStatistics(string pid) {

PlayFabServerAPI.UpdatePlayerStatistics(

new UpdatePlayerStatisticsRequest() {

PlayFabId = pid, Statistics = new List<StatisticUpdate>() {

new StatisticUpdate() {

StatisticName = "Headshots",

Value = 10 } } },

result => Debug.Log("Complete"), error => Debug.Log(error.GenerateErrorReport()) ); }

,

I am getting this error when I used below code

public void UpdatePlayerStatistics(string pid) {

PlayFabServerAPI.UpdatePlayerStatistics(

new UpdatePlayerStatisticsRequest() {

PlayFabId = pid,

Statistics = new List<StatisticUpdate>() {

new StatisticUpdate() { StatisticName = "Headshots", // Version = 2, Value = 10 } } },

result => Debug.Log("Complete"), error => Debug.Log(error.GenerateErrorReport()) ); }

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

·
Citrus Yan avatar image
Citrus Yan answered

Most likely you used the wrong UpdatePlayerStatisticsRequest class, you should use the one from the “PlayFab.ServerModels” namespace, please do the following:

using UpdatePlayerStatisticsRequest = PlayFab.ServerModels.UpdatePlayerStatisticsRequest;

or:

new PlayFab.ServerModels.UpdatePlayerStatisticsRequest() {…}
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.