Using iOS Game Center Leaderboards

Choose your OS:

iOSleaderboard.png

Configuration

Please see Leaderboards, Achievements and Challenges for information on setting up the iOS Game Center for your application.

For your Unreal Project:

  1. In the Edit menu in Unreal Editor, select Project Settings to view the configuration options for your project.

  2. On the left, Select the Platforms: iOS tab.

  3. Set Enable Game Center Support to True

If you are planning to release your application on both Android and iOS devices, please see Using Google Play Services Leaderboards for addition information on setting up your leaderboards.

Reading from a Leaderboard

The Read Leaderboard Integer node will request from the platform's game service (currently iOS Game Center, or Google Play Services), the value stored on the given Stat Name for the provided Player Controller.

Note that it is a latent node, and thusly has a number of execution output pins. The top most is a "pass through," that works like any other execution output pin. The other two pins (On Success, and On Failure) will execute when the online service returns (or fails to return) a value. The value of Leaderboard Value before a successful return (or if the service fails to get a response) will be 0.

In Blueprints:

The example below is from the Global Game Instance Blueprint in the Unreal Match 3 sample game. In these few nodes we're calling the Read Leaderboard Integer node for the Player Controller at Player Index 0 on the Stat Name (Leaderboard) "Match3HighScore":

readLeaderboard.png

Writing to a Leaderboard

The Write Leaderboard Integer node will send the given integer Stat Value to the leaderboard specified in Stat Name for the provided Player Controller.

In Blueprints:

The example below is from the VictoryScreen Blueprint in the Unreal Match 3 sample game. When the victory (or defeat) screen is shown, it will check to see if on load Unreal Match 3 was able to retrieve a high score, then if it was able to it will submit the latest high score to the leaderboard. There is some additional checking before this to see if the new highscore is more than the one that was pulled during the app startup, but even if that wasn't there, the iOS and Android leaderboard systems will only accept values greater than what they currently store.

writeLeaderboard.PNG

Showing the Platform Specific Leadboard

The Show Platform Specific Leaderboard Screen will show the leaderboard specified by Category Name on the device.

In Blueprints:

The example below is from the GameOverButtons Blueprint Widget in the Unreal Match 3 sample game. When the ShowScores button is pressed, the game will attempt to show the leaderboard.

showLeaderboard.png