question

Benjamin avatar image
Benjamin asked

Problem no work sent leaderboard HIGSCORE

    public void SendLeaderboard(ProtectedUInt32 score)
    {
        var request = new UpdatePlayerStatisticsRequest
        {
            Statistics = new List<StatisticUpdate>
            {
                new StatisticUpdate
                {
                    StatisticName = "Top Score",
                    Value = Convert.ToInt32(score)
                    }
            }
        };
        PlayFabClientAPI.UpdatePlayerStatistics(request, OnLeaderboardUpdate, OnError);
    }




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


    public void SendLeaderboardHigh(ProtectedUInt32 score)
    {
        var request = new UpdatePlayerStatisticsRequest
        {
            Statistics = new List<StatisticUpdate>
            {
                new StatisticUpdate
                {
                    StatisticName = "PlayerHighScore",
                    Value = Convert.ToInt32(score)
                    }
            }
        };
        PlayFabClientAPI.UpdatePlayerStatistics(request, OnLeaderboardUpdateSave, OnError);
    }


    void OnLeaderboardUpdateSave(UpdatePlayerStatisticsResult result)
    {
        Debug.Log("Successfull leaderboard sent save");
    

=========================================================

public void OnGetStats(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 "PlayerLevel": //PERFECT
                    PlayerLevel = eachStat.Value;
                    playerLevel.text = PlayerLevel.ToString();
                    playerLevelsmall.text = PlayerLevel.ToString();
                    break;
                case "Top Score": //PERFECT
                    TopScore = eachStat.Value;
                    playerscore.text = TopScore.ToString();
                    break;
                case "PlayerHighScore": //PERFECT
                    PlayerHighScore = eachStat.Value;
                    playerhighscore.text = PlayerHighScore.ToString();
                    break;
                case "Top Win": //PERFECT
                    TopWin = eachStat.Value;
                    winnertext.text = TopWin.ToString();
                    break;
                case "PlayerHighWin": //PERFECT
                    PlayerHighWin = eachStat.Value;
                    winnerhightext.text = PlayerHighWin.ToString();
                    break;
            }
        }
    }
apisunity3dLeaderboards 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

·
Sarah Zhang avatar image
Sarah Zhang answered

After testing, we found the function SendLeaderboardHigh can work fine. Could you please provide the detailed information for our reference? For example, what are the specific error messages and the corresponding line number? And which are the Unity version, PlayFab extension verion and PlayFab SDK version you used? Are there any reproduced steps?

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.