Skip to main content

Loading Avatars

Developers are able to load a user’s Genie Avatar into an Experience.

UserAvatar Component

Avatars are loaded and controlled through the UserAvatar component. You can add this component to any GameObject to represent an Avatar instance loaded from the user account.

Component Properties

The following properties can be configured in the Inspector window:

  • Animator Controller: The animator controller that will be automatically assigned to the Avatar animator when loaded.
  • Overlays: A list containing references to AvatarOverlay prefabs that will be instantiated on top of the Avatar when loaded.

UserAvatar Component

info

You can safely destroy any GameObject containing a UserAvatar component, and all the resources associated with the loaded Avatar will be released from memory.

TypeScript Example

Here is an example script that initializes the Genies SDK, creates a User Avatar component, and loads an Avatar:

import { MonoBehaviour } from "UnityEngine";
import { GeniesSdk } from 'Genies.Components.SDK.Core';
import { UserAvatar } from "Genies.Components.Sdk.External.Avatars";

export default class MyScript extends MonoBehaviour {
private async Start() {
//Initialize the SDK
await GeniesSdk.Initialize();
//Create User Avatar component and load Avatar
let myAvatar = await UserAvatar.CreateAndLoadUserAvatar();
}
}