Apple Game Center
Configuration
First start by installing the GameKit Unity Plugin found in the Apple Unity Repository.
Then in the Unity Editor menu, go to Edit > Project Settings…, then select Services > Authentication from the navigation menu.
Set ID Providers to Apple Game Center, then select Add.
Enter the Bundle ID from the Apple developer console in the Bundle ID text field, then select Save. The Bundle ID should look like this: "com.lootlocker.hector".
The timestamp input will only be valid for 30 minutes for security reasons.
Start Session
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
Refreshing a Session can be done in order to start the session without going through the entire StartAppleGameCenterSession() flow, if 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");
});
Congratulations - you have now started using LootLocker in your game with Apple Game Center! Next up we suggest you look at our feature set, and decide which ones you want to use in your game.
Last updated