playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.45k stars 962 forks source link

PlayGamesPlatform.Instance.GetAchievement (achievementId) missing in latest 0.9.64 #2608

Open Tanek81 opened 5 years ago

Tanek81 commented 5 years ago

Hi, in latest release (0.9.64, commit: 93d87d53617500645f1cbbf36f9aefa0fce72070) the PlayGamesPlatform.Instance.GetAchievement (achievementId) is missing and I don't see any other way of obtaining an achievement other than cycling all of them with the existing callback. This was useful to check if an incremental achievement was unlocked in order to avoid further call for it.

Example code:

PlayGamesPlatform.Instance.IncrementAchievement (achievementId, increment, (bool success) => {
   if (success) {
      Debug.Log ("Incremental achievement " + achievementId + " incremented by " + increment);
      //if this unlocks it, I don't want to call for it any more in the future
      if (PlayGamesPlatform.Instance.GetAchievement (achievementId).IsUnlocked) { //FIXME UPDATE GPG 0.9.64
         GameManager.Instance.Game.AddUnlockedAchievement (achievementId);
         Debug.Log ("Unlocked incremental " + achievementId);
      }
   } else {
      Debug.LogError ("Failed to increment " + achievementId);
   }
});

Is there any way of doing this now? Thanks!

nhtai2004 commented 5 years ago

Me too!

Xirion11 commented 5 years ago

I want to know too. I'm upgrading my game to use the latest version of the plug-in and now I don't know how to check if I've unlocked a certain achievement.

This is what I used to check if an achievement was unlocked bool isAchievementOnlineUnlocked = PlayGamesPlatform.Instance.GetAchievement(achievementID).IsUnlocked;

ArmandCloud commented 4 years ago

Same here!

Tanek81 commented 4 years ago

@olehkuznetsov any news on this? Thank you :)

Teddymac22 commented 4 years ago

Has anyone figured out what we need to replace GetAchievement? I haven't updated google play games in quite a while.

olehkuznetsov commented 4 years ago

You can use PlayGamesPlatform.Instance.LoadAchievements. It's not optimal to call it for each increment, may be you can fetch it once in a ten seconds if any achievement was incremented.