版本: 2022.3
语言英语
  • C#

Social.LoadAchievementDescriptions

提出更改

成功!

感谢您帮助我们提高Unity文档的质量。虽然我们无法接受所有提交,但我们确实会读取用户提出的每个建议,并在适用的情况下进行更新。

关闭

提交失败

由于某些原因,您的建议无法提交。请过几分钟再尝试。感谢您花时间帮助我们提高Unity文档的质量。

关闭

取消

声明

public static void LoadAchievementDescriptions(Action<IAchievementDescription[]> callback);

描述

加载与此应用程序关联的成就描述。

这通常是在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"); }); } }