Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Social.LoadScores

static function LoadScores(leaderboardID: string, callback: Action<IScore[]>): void;
static void LoadScores(string leaderboardID, Action<IScore[]> callback);
static def LoadScores(leaderboardID as string, callback as Action<IScore[]>) as void

Description

Load a default set of scores from the given leaderboard.

This uses default leaderboard parameters.

        Social.LoadScores("Leaderboard01", scores => {
		if (scores.Length > 0) {
			Debug.Log ("Got " + scores.Length + " scores");
			string myScores = "Leaderboard:\n";
			foreach (IScore score in scores)
				myScores += "\t" + score.userID + " " + score.formattedValue + " " + score.date + "\n";
			Debug.Log (myScores);
		}
		else
			Debug.Log ("No scores loaded");
	});