Skip to content

Achievements and Leaderboards

Janzku edited this page Nov 21, 2014 · 1 revision

To use and to publish game in Google Play, you will need at least 5 achievement in your game. These features require player to have and log-in to (Google) Play Games.


How to create

You will create achievements and leaderboards in Google play Developer Console, where you will see their IDs.


How to use

Achievements

To use your created achievements in your game is quite simple. You have 3 functions to use:

  1. UnlockAchievement(achievement_id)

  2. IncrementAchievement(achievement_id, steps)

  3. ShowAchiements()

  • To unlock achievement, you simply call uthGPGS.achievement.UnlockAchievement("id"); from engine. This also unlocks and makes hidden achievements unhidden.
  • To increase steps in achievement that has steps, use uthGPGS.achievement.IncrementAchievement("id", steps); to progress achievement as many steps you want.
  • To see all your achievements, simply call uthGPGS.achievement.ShowAchiements(); which will call built-in achievement viewer and pause your game activity.

Leaderboards

To use your leaderboard(s), you have 2 simple function to use:

  1. SubmitHighScore(leaderboard_id, score)

  2. ShowLeaderboard(leaderboard_id)

  • Whenever you want to submit score to a certain leaderboard of your choice, simply call uthGPGS.leaderboard.SubmitHighScore("id", score);. However one player can only have one score on leaderboard. Submitting lower score than previous one does not update that players standings.
  • To show leaderboard to a player, call uthGPGS.leaderboard.ShowLeaderboard("id"); to show built-in leaderboard viewer. This also pauses your game activity.
Clone this wiki locally