GameKit.Initialize
------------------

Initialized GameKit.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [GameKit](component_GameKit.md) | [8.5](newinversion85.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "GameKit.Initialize" ) ### Parameters

none

### Result

Returns OK or error.

### Description

Initialized GameKit.  
Loads the framework, setups script triggers and loads local player.  
Must be called once before doing any other method.  
### Examples

Initialize GameKit:

 # Try to init GameKit   
Set Variable \[ $r ; Value: MBS ( "GameKit.Initialize" ) \]   
If \[ MBS ("IsError") \]   
 Show Custom Dialog \[ "Failed to initialize GameKit." ; $r \]   
 Exit Script \[ Text Result: \]   
End If  
\# Set script to call when player changes   
Set Variable \[ $r ; Value: MBS ( "[GameKit.SetPlayerDidChangeScriptTrigger](GameKitSetPlayerDidChangeScriptTrigger.md)"; Get(FileName); "PlayerChanged" ) \]   
\# Login if needed   
If \[ MBS ( "[GameKit.LocalPlayer.isAuthenticated](GameKitLocalPlayerisAuthenticated.md)" ) = 0 \]   
 # Show Login dialog  
 Set Variable \[ $r ; Value: MBS ( "[GameKit.LocalPlayer.Authenticate](GameKitLocalPlayerAuthenticate.md)" ) \]   
End If  
### See also

- [GameKit.LocalPlayer](GameKitLocalPlayer.md)
- [GameKit.LocalPlayer.Authenticate](GameKitLocalPlayerAuthenticate.md)
- [GameKit.LocalPlayer.isAuthenticated](GameKitLocalPlayerisAuthenticated.md)
- [GameKit.SetPlayerDidChangeScriptTrigger](GameKitSetPlayerDidChangeScriptTrigger.md)
- [IsError](IsError.md)

This function is free to use.

Created 5th November 2018 , last changed 8th November 2018

  
[GameKit.GameCenterView.ShowBannerWithTitle](GameKitGameCenterViewShowBannerWithTitle.md) - [GameKit.Leaderboard.GetPlayerScope](GameKitLeaderboardGetPlayerScope.md)

[HTML Version](GameKitInitialize.shtml)