完成成就时在iOS上显示默认横幅。
这仅在iOS 5.0及以上系统中有效,在旧版本中不起作用。代码示例
using UnityEngine; using UnityEngine.SocialPlatforms.GameCenter;
public class DoAchievement : MonoBehaviour { void Start() { GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); Social.localUser.Authenticate(success => { if (success) ReportAchievement(); else Debug.Log("Failed to authenticate"); }); }
void ReportAchievement() { Social.ReportProgress("Achievement01", 100, (result) => { Debug.Log(result ? "Reported achievement" : "Failed to report achievement"); }); } }