I am working on adding Game Center achievements in my game using Unity’s Social API and had a few questions about best practices.
I have achievements “working”, but it doesn’t seem quite right how I currently have set up. I’m hoping someone here that has used the API can help me out!
Here are my steps:
- Authenticate user (Social.localUser.Authenticate()
- After user is authenticated, load Achievements (Social.LoadAchievements()). NOTE: Any/all achievements that have 0 progress are NOT loaded. So the first time they are loaded, the list will be empty.
- Cache results that are loaded in so I can check them throughout game to report progress.
- After reporting progress on an achievement, go back to #2. NOTE: After successfully adding progress, the LoadAchievements USUALLY still shows 0 items in the achievements list. It must take some time?
Here are my main problems I would like to solve.
A) After I report progress, should I update my own cached list to keep track of progress internally instead of trying to LoadAchievements immediately afterwards? (considering sometimes they don’t get updated right away after the load).
B) If caching achievements is the way to go, then what do I do if there are 0 achievements loaded because they have 0 progress and I want to update their progress? Do I send the progress using Social, then create my own 1st entry into my own cached list and use that?
It all just seems very messy so it would be great to see how other people have implemented this. It shouldn’t be this complicated, so I’m hoping I’m just missing something.
I appreciate you taking the time to read my post, thanks in advance for any help you can give!