question

Derek Briggs avatar image
Derek Briggs asked

PlayFab not returning correct player stats,PlayFab not returning or saving player stats

I've been using the "GetPlayerStatistics" call to obtain the player's Highscore that's being stored against the players account but recently this call has stopped returning up to date information and now I'm no longer to obtain accurate stats associated with the players account.

For example, the players "HighScore" was 12 - when they hit 13 the database would still return 12. After updating the data manually in Playfab the API still returns 12 - however this value no longer exists so why is PlayFab still returning the old key value pair and not the updated one?

I've followed the documentation and I've attached what I've implemented below - if anyone can help me out with this issue it would be greatly appreciated.

    public void GetPlayerStats()
    {
        PlayFabClientAPI.GetPlayerStatistics(new GetPlayerStatisticsRequest(),
            OnGetStatistics,
            error => Debug.LogError(error.GenerateErrorReport())
        );
    }


    public void OnGetStatistics(GetPlayerStatisticsResult result)
    {
        Debug.Log("Received the following Statistics:");


        foreach (var eachStat in result.Statistics)
        {
            Debug.Log("Statistic (" + eachStat.StatisticName + "): " + eachStat.Value);


            switch (eachStat.StatisticName)
            {
                case "PlayerHighScore":
                    pf_playerHighScore = eachStat.Value;
     
                    break;


            }            
        }

    }
,
Player Data
1 comment
10 |1200

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

Sarah Zhang avatar image Sarah Zhang commented ·

We can't reproduce this issue in the testing title, could you please provide the TitleId and the specific player's PlayFabId?

0 Likes 0 ·

1 Answer

·
Derek Briggs avatar image
Derek Briggs answered

Hi @Sarah Zhang I copy and pasted the code above and changed the name of the variable on line 23 and it now works - haven't been able to find the root cause though.

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.