• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by OWL7seven · Apr 20, 2014 at 11:48 PM · c#androidplayerprefsgoogle playachievements

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?)

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image

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

Comment
shashKing

People who like this

1 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

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.

Comment
shashKing

People who like this

1 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

How to use PlayerPrefs to activate game objects permanently? 1 Answer

How do I ensure that all necessary obb main files and expansions have been downloaded? 0 Answers

How to access android sharedpreferences using unity c# ? 2 Answers

GPGS - How to check if a Saved Game file exists? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges