Test Unlocking Achievements and Leaderboard Scores

QAing Time!

Let’s get to testing! This is the moment we cross our fingers, make another coffee, and hold our breath.

1. First, go to the Game Centre App on your device and LOG OUT if you are logged in on a non-sandbox user account. Don’t worry about logging in at this stage.

2. Build!

3. Wait……

4. Ensure the build to your device is successful and running

5. All going well, Game Centre would’ve automatically opened a log-in screen. Use one of your Sandbox Test User accounts that you set up earlier (nothing else will work).

6. Once logged in, check that you can see all available achievements for your App, as entered into iTunes Connect. So go ahead and click on your Game Centre Button now.

7. The game centre screen should open up. Your leaderboard will be empty at this stage. Click on the Achievements tab to ensure you can see all achievements. If you can’t, return to iTunes Connect and double check that your Bundle ID precisely matches what you have in your code.

8. If you can see all achievements, then congrats! That’s the first successful test.

9. Now click on the button you assigned to post a score to the Achievement board. Do that now.

10. Return to the Game Centre screen button and click to see if your score got posted. If not, again, check that your Leaderboard name in code matches what you submitted in iTunes Connect.

11. Final test… click on the Achievement button you set up. The Achievement Banner should appear on the top of the screen to signify the achievement has been unlocked. If not, rewind back again and check that your Achievement IDs in your code matches the Achievement IDs you submitted  iTunes Connect.

12. If the banner appears, return to the Game Centre screen one last time to make sure that the appropriate Achievement now appears as ‘unlocked’.

13. Now go back and click that VERY SAME button you used to unlock this achievement, and click again. The Achievement Banner should NOT appear. If it does… hm… contact us?

 

The End!

So that’s it! You have Achievements unlocking and scores posting to your Leaderboard! We hope this walkthrough has helped you, and please let us know if you think we’ve missed a step, or something doesn’t work for you – we’ll do our best to assist. And if you have improved methods, be sure to share!

Good luck to all of you for great App success!

If you’d like to send us a comment directly, please use the following form:

Accessing and Posting to Game Centre

1. Return to your  Game Centre “Button” script we asked you to open at the start of this How-To, as we’re about to launch Game Centre!

2. In your script, add the following:

//OPEN GAME CENTRE
GameCenterBinding.showAchievements()

3. Now when your Game Centre button is clicked, Game Centre will open. But don’t do that just yet, let’s move on….

4. For the sake of testing, let’s set up unlocking your first Achievement when the user clicks on another button. Select a quick-to-navigate-to button, that won’t load up a new scene, such as a Help button that you may have in your title menu. If you have no buttons, just make a fake one for now for the sake of testing Achievement unlocks

5. In the script that you use to activate the button in step 4, add the following line of code:

GCManager.ReportAchievement("YOURACHIEVEID");

Note that “YOURACHIEVEID” must be EXACTLY what you entered for the Achievement’s ID in iTunes Connect.

Alternatively, if you have an achievement that requires progress or a collection in order to unlock it (e.g. collect x items, and it shows the progress of those items collected, call the following:

GCManager.ReportAchievementProgressive("YOURACHIEVEID", 25.0f);
//Note the float number provided must have "f" next to it
//Where "25.0f is the percentage of this particular instance - i.e. it's 25% complete.
//e.g. If you have 100 items to collect in order to gain the achievement,
//in each instance when the player collects that item, you would call the above
//and insert the number "1.0". 

6.The above script will call on the method from the GCManager.cs script. Don’t test just yet… we want to set a score to the Leaderboard.

7. Now we’ll add in the call to update the Leaderboard with a new high score. If you don’t already have end-game functionality set up for your scores yet, then just choose some other random button that you can fire this score posting from. Add the following line to your end-game or button script:

GCManager.UpdateLeaderWithScore(thescore);

Of course “thescore” should be a LONG integer type. You can either just enter in any random number for now for the sake of testing, like “9999999”, or add the string variable that your score posts to. We’ll let you sort that bit out…

So that’s it! You’re all set-up and ready to go. That wasn’t so painful was it? 😛
Time to Test Unlocking Achievements and Leaderboard!

Prep iTunesConnect for Game Centre – Sandbox Users

Before you do anything in Unity, we suggest you stop to spend time setting up your App in iTunes Connect. If you haven’t got your App registered, then do so now. If you’re not sure how to do this, we’ll be writing a blog page for that soon. In the meantime, please visit the Apple Developer website. When your App is set-up on iTunes Connect, you’re ready to go…..

a. Create a few Sandbox Test Users

i  On the “Opening Page” of iTunes Connect, after you log in, select Manage Users

ii. Select User type: Test User

iii Add new users

Make up any details you want for your Sandbox Tester User Accounts.
You can also make up the email address – e.g. cool@diddlysquat.com… Just make sure you remember the password you set! And choose the appropriate local store, too.

v Repeat steps iii – iv above until you have a few users to play and test with

Now you’re ready to move to the next step in prepping iTunes – setting up your Achievements and Leaderboard