版本: 2022.3
语言英语
  • C#

Social.LoadAchievements

建议更改

成功!

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

关闭

提交失败

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

关闭

取消

声明

public static void LoadAchievements(Action<IAchievement[]> callback);

描述

加载登录用户已实现的或已报告进度的成就。

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

public class ExampleClass : MonoBehaviour { void Start() { Social.LoadAchievements(achievements => { if (achievements.Length > 0) { Debug.Log("Got " + achievements.Length + " achievement instances"); string myAchievements = "My achievements:\n"; foreach (IAchievement achievement in achievements) { myAchievements += "\t" + achievement.id + " " + achievement.percentCompleted + " " + achievement.completed + " " + achievement.lastReportedDate + "\n"; } Debug.Log(myAchievements); } else Debug.Log("No achievements returned"); }); } }