API Index
Overview
Setup
Initialize
Achievements
Challenges
Leaderboards
Scores
Players
Real-Time Game
Turn-Based Game
 
Before you can initialize the GameKit Plugin, it must be setup.
 
Initialize GameKit Plugin
Initialize
Show Game Center Sign In UI
 

Initialize
Comments: Initialize GameKit Plugin and the local player’s authentication. Your game should authenticate the local player as early as possible after launching. Call gameKit.init() only one time after your game launches because each time your game moves from the background to the foreground, GameKit automatically authenticates the local player again. If your game calls gameKit.show( “gameCenterSignInUI” ) after event.type == “showSignInUI” and the local player signs into Game Center, the “authenticated” event.type is sent to the init callback function. Note that other Game Center functions should not be called when the local player has not been authenticated.

Function: (function) init( (function) onCallback )
Required Parameter: (function) callback – A function to receive callback events.
Callback Events:
Event Name: (string) “gameKitLibrary”
Event Type:
(string) “error” – GameKit error event.
(string) “showSignInUI” – Local player is not signed in to Game Center. If event.type == “showSignInUI” call gameKit.show( “gameCenterSignInUI” ) when convenient to allow local player to sign in.
(string) “authenticated” – Game Center was able to authenticate the local player.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(string) localPlayerID – A player identifier string assigned by Game Center to uniquely identify the local player.
(string) localPlayerAlias – An alias string chosen by the local player in Game Center to identify themselves to other players.
(boolean) localPlayerIsUnderage – Some Game Center features are disabled if the local player is underage (children under 13 years old). Your game can also use this property if it wants to disable some of its own features based on the player’s age.

 

Show Game Center Sign In UI
Comments: Show Game Center Sign In UI if local player isn’t automatically signed in on game app launch to allow them sign in.

Function: show( (string) “gameCenterSignInUI” )
Param Table Keys: none
Callback Events:
Event Name: (string) “gameKitLibrary”
Event Type:
(string) “error” – GameKit error event.
(string) “authenticated” – Game Center was able to authenticate the local player.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(string) localPlayerID – A player identifier string assigned by Game Center to uniquely identify the local player.
(string) localPlayerAlias – An alias string chosen by the local player in Game Center to identify themselves to other players.
(boolean) localPlayerIsUnderage – Some Game Center features are disabled if the local player is underage (children under 13 years old). Your game can also use this property if it wants to disable some of its own features based on the player’s age.