版本:2022.3
语言英文
  • C#

Social.LoadScores

建议更改

成功!

感谢您帮助我们提升Unity文档的质量。虽然我们无法接受所有提交,但我们确实阅读了每位用户提出的建议,并将根据实际情况进行更新。

关闭

提交失败

由于某些原因,您的建议无法提交。请 <a>几分钟后再次尝试</a>。并感谢您花时间帮助我们提升Unity文档的质量。

关闭

取消

声明

public static void LoadScores(string leaderboardID, Action<IScore[]> callback);

描述

从给定的排行榜中加载一组默认分数。

这使用默认的排行榜参数。

using UnityEngine;
using UnityEngine.SocialPlatforms;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { 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"); }); } }