Skip to content

Leaderboards

Kopfenheim edited this page Jan 29, 2018 · 2 revisions

Functions which allow you to manipulate the leaderboards functionality of Google Play Game Services. Make sure to create a leaderboard in the Google Play Console under your "Google Services" game. Record the IDs for the leaderboards you want to manipulate in the game. It is recommended that you store them as const values in your script.

Functions

  • showLeaderboardUI(String leaderboardID)

    Displays the default Google Play Game Services' Leaderboard UI. This allows the player to see the top players on that leaderboard

    • Parameters
      • leaderboardID: The ID of the leaderboard that you wish to display the UI for
    • Returns
      • boolean: true if the leaderboard UI was started successfully and false otherwise
  • submitScore(String leaderboardID, int score)

    Submits the players score to a leaderboard

    • Parameters
      • leaderboardID: The ID of the leaderboard that you wish to display the UI for
      • score: The player's score that we want to submit to the leaderboard
    • Returns
      • Nothing

Callbacks

Uses the third instance ID passed to init() through instanceIDsStr when initializing the module (i.e. {id for Leaderboards script})

However, there are no callbacks defined for this functionality