âĄQuickstart - Unity SDK
Get started with the Unity SDK in under 10 minutes.
If you followed the Set-up Unity & Import the SDK section, your script should look something like this:
Next, we'll finalize it to provide you with a complete template for integrating UGE into your game:
Let's review the different steps of the code together!
1. Reminder: Initialize the SDK and register a callback
Before Initializing the SDK (which is an asynchronous process), you can register a callback to call subsequent functions of the SDK:
Then, you can initialize the SDK with the configuration you want:
More info: SDK Initialization - Unity
2. Register your local player
Your character has to be an humanoid
To play emotes, you can use an already configured character from your game which has an animator for exemple (custom animation systems are supported, please visit Animation System - Unityfor more info) You can call the RegisterLocalPlayerAnimator method to easily register a character
If you uploaded an avatar in our Developer Portal, you can also pass the avatarID matching the player character you registered to benefit from the Contact-Aware Retargeting.
More info: Animation System - Unity
3. Link your game's account system with Kinetix SDK
We will focus on this part of the code:
We use the ConnectAccount method, establishing a link between the user account on your end and within Kinetix's system.
The userID you give to Kinetix must be reused each time you want to connect this specific user, and it must remain exclusive to them.
While it can be a hash or any string, we highly recommend anonymizing user data and refraining from incorporating any personal information.
More info: Account Management in Unity
4. Get ready to use User-Generated Emotes
Let's check the following code (inside the success callback of ConnectAccount)
As you can see, we provide a way to know when a link / token to the Web Application is invalid (either because of the security token expiration or after usage).
You can then call a method to get the link to the Web Application, and attach it to a script to open the web browser (for example with Application.OpenURL)
More info: User-Generated Emote integration (Unity)
5. (After processing) Get the emote of your player
To get your player's emotes, you can call GetUserAnimationMetadatas, which will return an array of AnimationMetadata, containing all the info you will ever need (name, thumbnail, file links, etc...)
As you can see you can get the Id of an emote by accessing the Ids.UUID property of an AnimationMetadata
More info: Account Management in Unity
6. Play the emote
Once we have the id of the emote we want to play (and the local player has been registered), we can just call:
More info: Unity's Animator System
You've done it!
You should be ready to use the SDK now! We encourage you to visit SDK Core Modules activation - Unity to expand your knowledge of the SDK or our SDK API Reference - Unityto check what methods are available.
Last updated