âŒĻïļSDK Initialization - Unity

Initialize the Kinetix Unity SDK, has to be done to be able to call its API

The initialization of the Kinetix SDK should only be done ONCE when the app starts

You can initialize the SDK with parameters in the KinetixCoreConfiguration :

  • GameAPIKey => Game API Key, obtainable via Dev portal

  • PlayAutomaticallyAnimationOnAnimators => true if you want the SDK to handle the animator.

  • EnableAnalytics => true if you want to help us and share general informations of how users use our SDK.

  • ShowLogs => true if you want to log the behaviour of the SDK for debug purposes.

  • EnableUGC => true if you want to enable UGC

  • NetworkConfiguration => Customize network configuration

  • CachedEmotesNb => Number of emotes cached in storage (0.5 MB / emote)

[SerializeField] private Animator myAnimator;
[SerializeField] private string myConnectedUserID;

private void Awake() 
{
	// Initialization is an async process, 
	// We use a callback to tell when it's finished
	KinetixCore.OnInitialized           += OnInitialize;
	KinetixCore.Initialize(new KinetixCoreConfiguration()
	{
		GameAPIKey = "yourGameAPIKey",
		PlayAutomaticallyAnimationOnAnimators = true,
		EnableAnalytics = true
	});
}

// This callback is used for the actions made after the SDK is initialized
// Such as initializing the UI and Registering our LocalPlayer's animator
private void OnInitialize()
{
	// Register local player to receive animation
	// See "Animation System" documentation
	KinetixCore.Animation.RegisterLocalPlayerAnimator(myAnimator);

	// Now, we connect the current user's account to get his emotes
	// The userID is chosen by you, and must be unique to each user
	// See "Account Management" documentation
	KinetixCore.Account.ConnectAccount(string myConnectedUserID, () => {
		Debug.Log("Account connected successfully");
	}, () => {
		Debug.LogError("There was a problem during account connection. Is the GameAPIKey correct?");
	});
}

Last updated