Hi, i successfully post player score to leaderboard (via update player statistics) but now i want to show that score in UI how can i do that please?
Hi, i successfully post player score to leaderboard (via update player statistics) but now i want to show that score in UI how can i do that please?
It sounds like you're asking about the actual player presentation layer (displaying things to the user). If so, that's entirely up to you. PlayFab is a backend service that you can use for a wide range of server-side functionality, but we do not interfere in the presentation layer in any way. Your best bet would be to check the asset store for packages that can assist you with your user interface components.
Hi, thanks for reply! I can get and show player name like this:
public void GetAccountInfo() { GetAccountInfoRequest request = new GetAccountInfoRequest(); PlayFabClientAPI.GetAccountInfo(request, OnGetAccountInfoSuccess, OnPlayFabCallbackError); } void OnGetAccountInfoSuccess(GetAccountInfoResult result) { Debug.Log(result.AccountInfo.TitleInfo.DisplayName); DisplayNamee.text = result.AccountInfo.TitleInfo.DisplayName.ToString(); } void OnPlayFabCallbackError(PlayFabError error) { Debug.LogWarning(error.ErrorMessage); }
And i want to make it also for player statistic ( statistic name is Kills ) how should i modify that code above to make it works for player statistics please?I really need help.Thank You!
You already have the statistic name, since that's the ID you use to write the statistic to the player, so it sounds like you're asking how to query for the player's statistic values, so that you can display them, yes?
If you just want to get the player's own statistics, you can use:
https://api.playfab.com/documentation/client/method/GetPlayerStatistics
The returned data is a StatisticValue list - each containing the name of the statistic, its current value, and the version of the statistic.
If you want to show a whole leaderboard, you can use any of the GetLeaderboard type API calls (like https://api.playfab.com/documentation/Client/method/GetLeaderboard). Those return a list of PlayerLeaderboardEntry objects, which contain all the information you need about each user, including the profile information you're allowing to be returned via Settings->Client Profile Options), as well as the next reset time for the leaderboard, and the current version number for the statistic.
2 People are following this question.