- Home /
How to get current user score with the Social API?
Hi, how are you doing? I'm using the Social API that comes with Unity 3.5 and I was trying to get the friends score with the Social.LoadScores method. Apparently I could get the friends scores (I only have 1 friend to test so not sure if I can have more than 1 score yet), but I cannot seem to be able to get the local user score & rank, could you help me? Thanks!.
Answer by TauseefCVS · Mar 30, 2016 at 02:49 PM
public void Load_scor_score () { Social.LoadScores (leader.leaderboard_player_positions, scores => { if (scores.Length > 0) { //Debug.Log ("Got " + scores.Length + " scores"); string myScores = "Leaderboard:\n"; foreach (IScore score in scores) myScores += "Score :" + score.formattedValue; txt1.text = (myScores); txt1.color = Color.white; } else txt1.text = ("No scores loaded"); }); }
Answer by zoranigic · Jan 15, 2020 at 03:52 PM
You can get local user score from leader board:
ILeaderboard leaderboard = Social.CreateLeaderboard();
IScore localUserScore = leaderboard.localUserScore;
string value = localUserScore .formattedValue;
int rank= localUserScore.rank;
Your answer
![](https://koobas.hobune.stream/wayback/20220613080123im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
What are the "default leaderboard parameters" for Social.LoadScores? 1 Answer
ILeaderboard on iOS is not working? 0 Answers
Lag in Social.LoadAchievements or Social.ReportProgress 0 Answers
Google +1 Button on Unity Android 1 Answer
Is there an easy way to tell if Social.ReportScore is passed a new highscore? 0 Answers