Social.LoadScores

Unity · Версия 2020.3 LTS · Scripting · Social

Social.LoadScores

Объявление

public static void LoadScores(string leaderboardID, Action 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");
        });
    }
}

Обновлено 17 ноября 2026 г.