Version: 2022.3

Social.LoadAchievementDescriptions

切换到手册
public static void LoadAchievementDescriptions (Action<IAchievementDescription[]> callback);

描述

Loads the achievement descriptions associated with this application.

这通常是在 Unity 外部在实现提供程序提供的某个外部服务上设置的。例如,在使用 GameCenter 时,您需要使用 iTunes Connect 设置成就。

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

public class ExampleClass : MonoBehaviour { void Start() { Social.LoadAchievementDescriptions(descriptions => { if (descriptions.Length > 0) { Debug.Log("Got " + descriptions.Length + " achievement descriptions"); string achievementDescriptions = "Achievement Descriptions:\n"; foreach (IAchievementDescription ad in descriptions) { achievementDescriptions += "\t" + ad.id + " " + ad.title + " " + ad.unachievedDescription + "\n"; } Debug.Log(achievementDescriptions); } else Debug.Log("Failed to load achievement descriptions"); }); } }