我想在游戏中做排行榜。 我创建了它,但是当我使用LeaderBoard按钮打开时,没有写下来。
private void Start () {
Social.localUser.Authenticate (success => {
if (success) {
Debug.Log ("Authenticated, checking achievements");
// Request loaded scores, and register a callback for processing them
ILeaderboard leaderboard = Social.CreateLeaderboard();
leaderboard.id = "secretID";
leaderboard.LoadScores(result => {
Debug.Log("Received " + leaderboard.scores.Length + " scores");
});
}
else
Debug.Log ("Failed to authenticate");
});
}
public void OpenLeaderboard() {
Social.ReportScore (15, "secretID", result => {
Debug.Log(result ? "Reported score successfully" : "Failed to report score");
});
UnityEngine.SocialPlatforms.GameCenter.GameCenterPlatform.ShowLeaderboardUI ("grp.warior.game", TimeScope.Week);
}