- Home /
Few questions about Unity3D and Google Play Leaderboards
Im starting work with the google play services, specifically with the leaderboards. I did everything according to the tutorials, but i still have a few questions.
Social.localUser.Authenticate(authenticated =>
{
if (!authenticated || !Social.localUser.authenticated)
{
throw new System.Exception();
}
Social.ReportScore((long) (GameObject.FindGameObjectWithTag("Disp").GetComponent<timer>().tmp * 1000), level_key, (bool success) =>
{
if (success)
{
Social.ShowLeaderboardUI();
}
else
{
throw new System.Exception();
}
});
});
1) Is there a way to show player not all leaderboards, but the leaderboard of current level? 2) By default leaderboards shows results between friends, can i easily switch it to global?
Answer by Akash-bhatt · Feb 04, 2017 at 03:00 PM
1)YES If you wish to show a particular leaderboard instead of all leaderboards, you can pass a leaderboard ID to the method. This, however, is a Play Games extension, so the Social.Active object needs to be cast to a PlayGamesPlatform object first:
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
...
// show leaderboard UI
PlayGamesPlatform.Instance.ShowLeaderboardUI("Cfji293fjsie_QA");
2)Yes there is options in leaderboard to switch to global
Thanks for the reply, but it's not what i'm looking for. I've found better solution.
PlayGamesPlatform.Instance.LoadScores(
GPGSIds.leaderboard_leaders_in_smoketesting,
$$anonymous$$erboardStart.PlayerCentered,
100,
$$anonymous$$erboardCollection.Public,
$$anonymous$$erboardTimeSpan.AllTime,
(data) =>
{
mStatus = "$$anonymous$$erboard data valid: " + data.Valid;
mStatus += "\n approx:" +data.ApproximateCount + " have " + data.Scores.Length;
});
It's looking much more convenient. But it doesn't works :D And im trying to fix it
Seems that it just loads the data but i need to find a way to show this data in my UI..
Your answer
![](https://koobas.hobune.stream/wayback/20220612110309im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can i use Google play services leaderboards in beta testing? 0 Answers
How can I load every score from the leaderboard? 0 Answers
play-games-plugin: Loadscores ignore leaderboard's range settings 1 Answer
Google play services leaderboard not showing any scores 2 Answers
google play service problem with a game published in alpha mode 0 Answers