Hello,
I just added some Google Play achievements to my game yesterday, and I’m really hoping the solution to this is something simple like “wait for Google to sync” or something, even though the app and the achievements are all published.
So, as the title says, the achievements simply won’t unlock in Google Play. The conditions which unlock them are definitely running, because the in-game visuals are working fine, but the Google Play parts just won’t unlock the achievement, even though they’re running in the same (working) functions.
These are some of the scripts I’ve made which affect the GPGS achievements:
Condition that should unlock the achievement:
if (PlayerPrefs.GetInt("Achievement1") >= 1) //If Achievement 1 has been unlocked
{
progressCount += 1; //Increase the progress count by 1
achievement1Lock.SetActive(false); //Remove the padlock
achievementManager.UnlockAchievement(GPGSIds.achievement_the_first_night); //Grant the achievement in Google Play
}
else //If the Achievement has NOT been unlocked
achievement1Txt.text = "????"; //Don't show the achievement's title
Function that should unlock the achievement:
public void UnlockAchievement(string _achievement) //Function for unlocking an Achievement
{
Social.ReportProgress(_achievement, 100.0f, (bool success) =>
{
if (success) //If the achievement is successfully granted
{
Debug.Log(_achievement + ": " + success.ToString()); //Report the achievement's success
}
else //If the achievement fails to be granted (i.e. no internet, not logged in, etc)
{
Debug.Log(_achievement + ": " + success.ToString()); //Report the achievement's failure -- NOTE that the 'success' value is taken from the achievement set up's settings, so should return as 'failed' here
}
});
}
These are just samples that should run to unlock the first achievement. I’ve set it up so that even if it didn’t unlock the first time (in case the player was offline or something), they won’t have to redo the achievement, and it will unlock when they view the in-game achievement list (which the first sample is taken from, as the PlayerPref value of “Achievement1” will always be 1 once the achievement should be unlocked).
Really hoping I can get by this, as everything else involved with these functions work except the stuff related to Google Play. As far as I can see, there’s no errors in the code or anything else.
Thanks in advance.