- Home /
How to get Achievement progress list (U3DXT)
Hey guys,
I've been working on putting Game Center support into my iOS game using the U3DXT plugin and I am stuck on figuring out how to get the progress on achievements for the current player from Game Center.
I've got the Submitting progress down but I would like to be able to check at launch whether or not any progress and how much has been made on all achievements.
I've looked through the API and I think I've found the method which is
public static void LoadAchievements(
Action<Object[], NSError> completionHandler
)
but I'm not that up to speed with coding so I can't quite figure it out, ultimately I would like to fill and array with achievement progress.
Thanks for your time, Andre.
Answer by u3dxt · Apr 03, 2014 at 12:43 AM
Hi, yes you would use the GKAchievement.LoadAchievements() call, passing it a delegate:
GKAchievement.LoadAchievements(delegate(object[] achievements, NSError error) {
if (error != null) {
Debug.Log("error: " + error.LocalizedDescription());
} else {
foreach (var obj in achievements) {
GKAchievement achievement = obj as GKAchievement;
double progress = achievement.percentComplete;
// check progress
}
}
});
Thank you very much, this will do nicely, I ended up getting to the point where I had the array but didn't realise this code:
G$$anonymous$$Achievement achievement = obj as G$$anonymous$$Achievement;
was the key to getting workable data out of it, cheers!
Your answer
Follow this Question
Related Questions
U3DXT: How to setup Achievement Banners 1 Answer
U3DXT: ResetAchievements method not visible? 1 Answer
Can I use Unity network system with Multipeer connectivity ? 0 Answers
Launching the appstore via u3dxt 1 Answer
Testing achievements 0 Answers