Skip to content

Apple Game Center

This how-to walks you through configuring Apple Game Center and starting a session from your game.

Prerequisites

  • Unity, Unreal, or Godot SDK installed and configured in your project (not required for REST).
  • An Apple developer account with access to the Apple Developer Portal.

Configuration

Install the GameKit Unity Plugin from the Apple Unity Repository.

In the Unity Editor menu, go to Edit > Project Settings…, then Services > Authentication. Set ID Providers to Apple Game Center, then select Add. Enter the Bundle ID from the Apple Developer Console (e.g. com.lootlocker.hector) and select Save.

Start Session

LootLocker stores the refresh token for the next time the player starts your game, so subsequent sessions can use the simpler refresh flow.

string bundleId;
string signature;
string playerId;
string salt;
string publicKeyUrl;
string timestamp;
LootLockerSDKManager.StartAppleGameCenterSession(bundleId, playerId, publicKeyUrl, signature, salt, timestamp, (response) =>
{
if (!response.success)
{
Debug.Log("error starting LootLocker session");
return;
}
Debug.Log("successfully started LootLocker session");
});

Refresh Session

Refresh the session instead of repeating the full StartAppleGameCenterSession() flow, as long as your session token is still valid.

LootLockerSDKManager.RefreshAppleGameCenterSession((response) =>
{
if (!response.success)
{
if (response.statusCode == 401) {
// Refresh token has expired, use StartAppleGameCenterSession
}
else {
Debug.Log("error starting LootLocker session");
}
return;
}
Debug.Log("session started successfully");
});

Conclusion

You've started using LootLocker in your game with Apple Game Center. Next, review LootLocker's full feature set to decide which other features to implement.