加载与此应用程序关联的成就描述。
这通常是在 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");
});
}
}