Skip to main content

API Reference

This page will list all APIs available in the Genies Avatar SDK.

tip

Checkout the framework pages for User Login, Load an Avatar, and Avatar Editor to see more information on the APIs and examples on how they are used.

Namespaces

GeniesSdk

namespace Genies.Sdk

The main namespace for all Genies SDK tools.

Classes

AvatarSdk

class Genies.Sdk.AvatarSdk

The main class with the methods, events, and parameters for the Genies Avatar SDK.

ManagedAvatar

class Genies.Sdk.ManagedAvatar

Represents an in-game or in-editor Avatar instance that can be loaded, modified, and managed through the SDK.

ManagedAvatarComponent

class Genies.Sdk.ManagedAvatarComponent

The MonoBehaviour component attached to the Avatar's root GameObject. Provides a bridge between Unity's GameObject system and this ManagedAvatar wrapper.

Interfaces

IGeniesUser

interface Genies.Sdk.IGeniesUser

Provides access to user-related data such as unique ID and username.

Enums

BodySize

enum Genies.Sdk.BodySize

Represents the types of body sizes an Avatar can be set.

Gender Types

enum Genies.Sdk.GenderType

Represents the types of genders an Avatar can be set.

Events

AvatarEditorClosed

System.Action AvatarSdk.Events.AvatarEditorClosed

Event raised when the Avatar Editor is closed.

AvatarEditorOpened

System.Action AvatarSdk.Events.AvatarEditorOpened

Event raised when the Avatar Editor is opened.

LoginAnonymousFailed

System.Action<(string applicationId, string failReason)> AvatarSdk.Events.LoginAnonymousFailed

Invoked when an anonymous sign-in fails. Provides the applicationId and failure reason.

LoginAnonymousSucceeded

System.Action<string> AvatarSdk.Events.LoginAnonymousSucceeded

Invoked when an anonymous sign-in succeeds. Provides the applicationId used.

LoginEmailOtpCodeRequestFailed

System.Action<(string email, string failReason)> AvatarSdk.Events.LoginEmailOtpCodeRequestFailed

Triggered when a request to send an email OTP (one-time passcode) fails. Provides the email and reason for failure.

LoginEmailOtpCodeRequestSucceeded

System.Action<string> AvatarSdk.Events.LoginEmailOtpCodeRequestSucceeded

Triggered when an email OTP code is successfully sent to the user’s email address.

LoginEmailOtpCodeSubmissionFailed

System.Action<(string code, string failReason)> AvatarSdk.Events.LoginEmailOtpCodeSubmissionFailed

Triggered when the user submits an invalid or expired OTP code. Provides the code and failure reason.

LoginEmailOtpCodeSubmissionSucceeded

System.Action<string> AvatarSdk.Events.LoginEmailOtpCodeSubmissionSucceeded

Triggered when the OTP code submission is successful and login continues.

UserLoggedIn

System.Action AvatarSdk.Events.UserLoggedIn

Triggered when a user has successfully logged in to the Genies platform.

UserLoggedOut

System.Action AvatarSdk.Events.UserLoggedOut

Triggered when the currently logged-in user logs out.

Parameters

IsAvatarEditorOpen

bool AvatarSdk.IsAvatarEditorOpen { get; }

Indicates whether the Avatar Editor UI is currently open.

IsAwaitingEmailOtpCode

bool AvatarSdk.IsAwaitingEmailOtpCode { get; }

Indicates if the SDK is waiting for the user to enter an email OTP code.

IsLoggedIn

bool AvatarSdk.IsLoggedIn { get; }

Indicates whether a user is currently authenticated within the SDK.

UrlGeniesHubSignUp

string AvatarSdk.UrlGeniesHubSignUp { get; }

Returns the URL for signing up or creating a Developer Portal account.

Methods

CloseAvatarEditorAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.CloseAvatarEditorAsync(bool revertAvatar)

Closes the currently open Avatar Editor asynchronously. It also will revert the Avatar back to its original definition if flagged.

EquipOutfitAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.EquipOutfitAsync(ManagedAvatar avatar, string wearableId, [System.Threading.CancellationToken cancellationToken = default])

Equips a wearable item (such as clothing, accessories - any item in the Outftit category) on the specified Avatar.

GetAvatarEditorAvatar

ManagedAvatar AvatarSdk.GetAvatarEditorAvatar()

Returns the Avatar instance being edited from the Avatar Editor.

GetLoggedInUserAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<IGeniesUser> AvatarSdk.GetLoggedInUserAsync()

Retrieves the user data of the currently logged-in user.

GetUserAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<IGeniesUser> AvatarSdk.GetUserAsync(string userId, string username)

Fetches user information for a specified user ID or username.

GetUserIdAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<string> AvatarSdk.GetUserIdAsync()

Retrieves the logged-in user’s unique Genies ID.

GetUserNameAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<string> AvatarSdk.GetUserNameAsync()

Retrieves the logged-in user’s username.

GetUsersAssetsAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<List<WearableAssetInfo>> AvatarSdk.GetUsersAssetsAsync()

Gets the assets of the logged in user. Returns a list of WearableAssetInfo structs containing AssetId, AssetType, Name, and Category.

GetWearableAssetInfoListAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<System.Collections.Generic.List<Genies.AvatarEditor.Core.WearableAssetInfo>> AvatarSdk.GetWearableAssetInfoListAsync([System.Threading.CancellationToken cancellationToken = default])

Returns a list of all wearable asset metadata available to the current Avatar or user.

GiveAssetToUserAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<(bool, string)> AvatarSdk.GiveAssetToUserAsync(string assetId)

Grants an asset specified by the assetId to a user, adding it to their inventory. If the user already has the asset, the method will return true with a string noting that the user already has the asset.

InitializeAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<bool> AvatarSdk.InitializeAsync()

Initializes the Avatar SDK. Is automatically called before using other API functions. Returns whether initialization succeeded.

IsUserSignedInAnonymously

(awaitable) Cysharp.Threading.Tasks.UniTask<bool> AvatarSdk.IsUserSignedInAnonymously()

Checks if the current logged in user is anonymous.

LoadDefaultAvatarAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<ManagedAvatar> AvatarSdk.LoadDefaultAvatarAsync([string avatarName = null], [Transform parent = null], [RuntimeAnimatorController playerAnimationController = null])

Loads a default Avatar model into the scene.

LoadFromLocalAvatarDefinitionAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<ManagedAvatar> AvatarSdk.LoadFromLocalAvatarDefinitionAsync(string profileId, CancellationToken cancellationToken = default)

Loads an Avatar definition from a local persistent json file. Returns a ManagedAvatar or null if failed.

LoadFromLocalGameObjectAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<ManagedAvatar> AvatarSdk.LoadFromLocalGameObjectAsync(string profileId, CancellationToken cancellationToken = default)

Loads an Avatar from a local GameObject. Returns a ManagedAvatar or null if failed.

LoadUserAvatarAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<ManagedAvatar> AvatarSdk.LoadUserAvatarAsync([string avatarName = null], [Transform parent = null], [RuntimeAnimatorController playerAnimationController = null])

Loads the logged-in user’s saved Avatar into the scene.

LogOutAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.LogOutAsync()

Logs out the current user and clears authentication state.

OpenAvatarEditorAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.OpenAvatarEditorAsync(ManagedAvatar avatar, [Camera camera = null])

Opens the Avatar Editor for the specified Avatar instance, optionally targeting a specific camera.

ResendEmailCodeAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<(bool succeeded, string failReason)> AvatarSdk.ResendEmailCodeAsync()

Re-sends the email verification or OTP code. Returns whether the resend succeeded.

SaveAvatarDefinitionLocallyAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.SaveAvatarDefinitionLocallyAsync(ManagedAvatar avatar, string profileId = null)

Saves the current Avatar definition to both json on device for local persistent data as well as to a scriptable object in Resources. The profileId is the name it saves to.

SetAvatarBodyTypeAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.SetAvatarBodyTypeAsync(ManagedAvatar avatar, GenderType genderType, BodySize bodySize, CancellationToken cancellationToken = default)

Sets the Avatar body type with specified gender and body size.

SetEditorSaveLocallyAndContinueAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.SetEditorSaveLocallyAndContinueAsync(string profileId)

Sets the Avatar Editor to save locally and continue editing.

SetEditorSaveLocallyAndExitAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.SetEditorSaveLocallyAndExitAsync(string profileId)

Sets the Avatar Editor to save locally and exit the editor.

SetEditorSaveRemotelyAndContinueAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.SetEditorSaveRemotelyAndContinueAsync()

Sets the Avatar Editor to save to the cloud and continue editing.

SetEditorSaveRemotelyAndExitAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.SetEditorSaveRemotelyAndExitAsync()

Sets the Avatar Editor to save to the cloud and exit the editor.

SetSkinColorAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.SetSkinColorAsync(ManagedAvatar avatar, Color skinColor, [System.Threading.CancellationToken cancellationToken = default])

Changes the Avatar’s skin color to the specified value.

StartLoginAnonymousAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<(bool succeeded, string failReason)> AvatarSdk.StartLoginAnonymousAsync([string applicationId = ""])

Starts the anonymous login flow by signing in with the given applicationId.

StartLoginEmailOtpAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<(bool succeeded, string failReason)> AvatarSdk.StartLoginEmailOtpAsync(string email)

Initiates an email-based OTP login flow by sending a one-time code to the specified email.

SubmitEmailOtpCodeAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<(bool succeeded, string failReason)> AvatarSdk.SubmitEmailOtpCodeAsync(string code)

Submits the OTP code received by email to complete login.

TryInstantLoginAsync

(awaitable) Cysharp.Threading.Tasks.UniTask<(bool isLoggedIn, string username)> AvatarSdk.TryInstantLoginAsync()

Attempts an automatic login using stored credentials.

UnEquipOutfitAsync

(awaitable) Cysharp.Threading.Tasks.UniTask AvatarSdk.UnEquipOutfitAsync(ManagedAvatar avatar, string wearableId, [System.Threading.CancellationToken cancellationToken = default])

Removes a wearable item from the Avatar.