- Home /
Google play achievements problem please help
hi i seem to have a problem with my achievements.
i got the leader board and all that working but i just cant seem to understand why my achievements and not working.
here my code C#
void Update () {
Social.ReportScore(PlayerPrefs.GetInt("!Score"), highscoreleaderboardid, OnSubmitScore);
if (PlayerPrefs.GetInt("!Score") > 19){
Social.ReportProgress(Achieve9, 20.0, OnUnlockAC);
}
if (PlayerPrefs.GetInt("!Score") > 39){
Social.ReportProgress(Achieve8, 40.0, OnUnlockAC);
}
if (PlayerPrefs.GetInt("!Score") > 59){
Social.ReportProgress(Achieve7, 60.0, OnUnlockAC);
}
if (PlayerPrefs.GetInt("!Score") > 69){
Social.ReportProgress(Achieve5, 70.0, OnUnlockAC);
}
if (PlayerPrefs.GetInt("!Score") > 79){
Social.ReportProgress(Achieve6, 80.0, OnUnlockAC);
}
if (PlayerPrefs.GetInt("!Score") > 98){
Social.ReportProgress(Achieve3, 100.0, OnUnlockAC);
}
if (PlayerPrefs.GetInt("!Retry") > 0){
Social.ReportProgress(Achieve3, 200.0, OnUnlockAC);
}
}
now i m working with playerPrefs for my score and (PlayerPrefs.GetInt("!Score") contains it now i had the achievements. when the total score reaches and total of say 20 it should unlock the first achievement. i have set on my google developer account the ammount of points need to unlock it but it still not working.
ie
if (PlayerPrefs.GetInt("!Retry") > 0){ Social.ReportProgress(Achieve3, 200.0, OnUnlockAC); } i set the points to 200 for this one on my dev account.
am i using the wrong code or what? ( i know this is for incremental is that why its not working?)
Answer by nikescar · Apr 21, 2014 at 12:56 AM
Is that code even compiling? When using floats, you need to have an "f" after them (100.0f for example). As far as using gpgs, look at this link for the suggested usage of incremental achievements: https://github.com/playgameservices/play-games-plugin-for-unity
Answer by Tekksin · Dec 15, 2014 at 11:20 AM
when you set up an achievement on the google play developer console for android, they give you a set of characters. You write "Achiev3" and whatnot to define your acheivement's ID, which is possible to be set up on the iOS platform, but it's not the same for android. For android, "Achiev3" would be something like "CgkI6siAydD546afAIQAg". Get this value by accessing your developer console, choosing your game services tab, selecting which game has the achievement, and then copying the value to the right of the appropriate achievement under "ID".
I just noticed your Achieve3 stuff is set up like a varaible. If this is a string variable, just make sure it equals whatever google gave you. However, since you're not using the variable anywhere else, I'm unsure why you won't just put it in quotes to make it the string it should be, and use the ID google gives you.
also, your progress reported value should never exceed 100.0f, because once it reaches 100.0f, the achievement is unlocked. So right away, there's something wrong with your logic when you use a value like 200. That value is the percent of the achievement that is unlocked, not how many points the achievement is worth.