question

Kohji avatar image
Kohji asked

Leaderboard always shows Value 0

Hello, my game is sending the value(which is not 0) to my leaderboard but the player's value is always 0. How can I fix this problem?

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

Kohji avatar image Kohji commented ·

It's solved. How can I delete this question?

0 Likes 0 ·
Kohji avatar image Kohji commented ·
public void SendLeaderboard(int score)
    {
        var request = new UpdatePlayerStatisticsRequest
        {
            Statistics = new List<StatisticUpdate>
            {
                new StatisticUpdate
                {
                    StatisticName = "NewLeaderboard",
                    Value = score
                }
            }
        };
        PlayFabClientAPI.UpdatePlayerStatistics(request, OnLeaderboardUpdate, OnError);
    }

    void OnLeaderboardUpdate(UpdatePlayerStatisticsResult result)
    {
        Debug.Log("Successfull leaderboard sent");
    }

0 Likes 0 ·
Xiao Zha avatar image
Xiao Zha answered

I test your code and it works fine if you have allowed client to post player statistics in API Features. Did you get any other error messages.

10 |1200

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

Kohji avatar image
Kohji answered

Sorry, It's not solved

10 |1200

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

Kohji avatar image
Kohji answered

I'm allowing client to post player statistics. I can't change Value but can change Name. I don't get any errors on Unity but I get a yellow warning message "UnityWebRequest.isHttpError is deprecated." on PlayFabEditorHttp.cs in Visual Studio Code. @Xiao Zha

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.

Xiao Zha avatar image Xiao Zha commented ·

What do you mean you can't change Value but can change Name? Can you provide the screenshots of your leaderboard which have problem. Did you get any event message in Play Stream Monitor when you update your Player Statistics.

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.