Home > Blockchain >  Get player nicknames for leaderboard - PlayFab
Get player nicknames for leaderboard - PlayFab

Time:11-03

I have a script that gets the username by PlayFab id and writes it to the variable TestName

It was taken (and slightly modified) from the original documentation: enter image description here

Are there any solutions for fast loading leaderboards?

CodePudding user response:

I don't know if this is the best way. The reason that the necessary data is not coming out seems to be because the leaderboard was not properly received.

GetLeaderboardResult _leaderBoard;

IEnumerator GetLeaderBoardData()
{
    int getLeaderBoard = 1;
    PlayFabClientAPI.GetLeaderboard(new GetLeaderboardRequest()
        {
            StartPosition = /*Some Value Setting*/,
            StatisticName = /*Some Value Setting*/,
            MaxResultsCount = /*Some Value Setting*/,
            ProfileConstraints =
            new PlayerProfileViewConstraints()
            {
                ShowLocations = true,
                ShowDisplayName = true
            }
        }, (result)=>
        {
            _leaderBoard = result;
            getLeaderBoard -= 1;
        }, (error)=>{});
    yield return new WaitWhile(()=>!(getLeaderBoard <= 0));
}

If you do as above, the appropriate leaderboard data will be put in a variable called '_leaderBoard'. If there is another way to asynchronously wait for a value to come in, you can use that method.

Hope this helps you. :)

CodePudding user response:

enter image description here

  • Related