Version: 2022.3

Social.LoadScores

切换到手册
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"); }); } }