Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

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

Social.LoadScores

Switch to Manual
public static function LoadScores(leaderboardID: string, callback: Action<IScore[]>): void;

Parameters

Description

Load a default set of scores from the given leaderboard.

This uses default leaderboard parameters.

#pragma strict
function Start() {
	Social.LoadScores("Leaderboard01", function(scores) {
		if (scores.Length > 0) {
			Debug.Log("Got " + scores.Length + " scores");
			var myScores: String = "Leaderboard:\n";
			for (var score: IScore in scores)
				myScores += "\t" + score.userID + " " + score.formattedValue + " " + score.date + "\n";
			Debug.Log(myScores);
		}
		else
			Debug.Log("No scores loaded");
	}
	);
}