I’m trying to implement achievements in my iOS game using Game Center and the Social API. I have 6 achievements registered on iTunes Connect as can be seen in the image below. However, when I call Social.ReportProgress with the Achievement ID, progress percent, and callback, it always fails to report it successfully and logs the error “Achievement ID not found”. I’ve noticed that while Social.LoadAchievements will return 0 results, Social.LoadAchievementDescriptions will return 3 descriptions named “Achievement01” etc.
Here is my code:
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SocialPlatforms;
using UnityEngine.SocialPlatforms.GameCenter;
using System.Collections;
public class GameCenter : MonoBehaviour {
void Start () {
if(!Social.localUser.authenticated)
login ();
GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
Social.ReportProgress("World1", 100, load);
}
void login() {
Social.localUser.Authenticate (success => {
if (success) {
//Log user information
Debug.Log ("Authentication successful");
string userInfo = "Username: " + Social.localUser.userName +
"\nUser ID: " + Social.localUser.id +
"\nIsUnderage: " + Social.localUser.underage;
Debug.Log (userInfo);
//Log description information
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");
});
//Log achievement information
Social.LoadAchievements (achievements => {
if (achievements.Length == 0)
Debug.Log ("Error: no achievements found");
else
Debug.Log ("Got " + achievements.Length + " achievements");
});
}
else
Debug.Log ("Authentication failed");
});
}
void load(bool result){
if(result){
Debug.Log ("Successfully reported progress");
} else {
Debug.Log ("Failed to report progress");
}
}
}
I always seem to successfully login, but it doesn’t know that my achievements are there. If anyone has more experience with the Social API, help would be greatly appreciated.
Same problem here. If anyone finds a solution, please post it here. This is the only thing holding up the submission of my game and it is quite frustrating.
I submitted my app to Apple without Game Center in this version. Considering all the examples and assets I saw did it the exact same way and also failed, I’m assuming it’s a bug in the way Unity 5 handles Game Center in iOS 8.
Prime31 makes a Game Center plugin, and their website notes that there is a bug with GameKit in Unity 5, but even after following their workaround, it still didn’t work for me.
If I call Social.LoadAchievementDescriptions I get a listing with all of my achievements as I have configured them on Itunes Connect with correct Id’s.
So this shows that the achievements have been setup on the servers correctly.
It is just when I call ReportProgress with those same Id’s things return a failed result.
-I can open and view GC correctly inside the game
-Leaderboards work perfectly, and scores are reporting correctly
-I can correctly see a list of all achievements in GC, however:
-I cannot report an achievement correctly. It always returns false, no matter what
I’m stuck at the same point, which is unfortunate. My game just reached 100k downloads and I have been preparing a giant update adding a lot of features and play modes as the game just keeps getting lots of downloads.
I guess I will just submit without achievements for now. This is disappointing as the new update has a virtual currency (gold) that the player uses to unlock different weapons. Unlocking each weapon completes an achievement. When the user uninstalls the game and then re-installs it later - if that achievement is complete then their weapon is once again unlocked. I use this method instead of keeping up with user accounts and player unlock progression on my own server.
Ah well… I’ll just get another update out as soon as Unity fixes this. Aside from this issue, I am quite loving Unity 5. Good job Unity team =)
I can get the listing of all my achievements without issues but I am unable to get Social.LoadAchievements to work at all, is there any hope that this will be fixed soon or someone will find a fix ?
I read the whole thread and the whole point is to be able to use an actual feature from the engine, not to have to use a costly third party plugin that will do the exact same thing.
Just so you know bufbot. The expensive plugin isn’t exactly the same as the built in. It is a lower level API and you can get a bit more debug error info back if you are having issues.
But yes it would be nice if the builtin stuff works. Bit dissapointing.