Skip to main content

Custom Avatar Editor

The Genies Avatar SDK has Avatar customization APIs that allow developers to modify Avatars and create custom Avatar Editors.

Custom Editor

Example​

Check out the Creating Custom Editor sample scene page to see an example of a custom Avatar Editor.

Avatar Editor API​

Genies Sdk Avatar Library​

using Genies.Sdk;

The Genies.Sdk library contains the APIs for creating a custom Avatar Editor.

Wearables​

GetDefaultWearablesByCategoryAsync​

AvatarSdk.GetDefaultWearablesByCategoryAsync(WearablesCategory, [System.Threading.CancellationToken]);

Gets default wearable assets (List<WearableAssetInfo>) for the given wearable categories (e.g. Hoodie, Shirt, Pants).

GetUserWearablesByCategoryAsync​

AvatarSdk.GetUserWearablesByCategoryAsync(UserWearablesCategory, [System.Threading.CancellationToken]);

Gets user-owned wearable assets (List<WearableAssetInfo>) for the given wearable categories (e.g. Hoodie, Shirt, Pants).

EquipWearableAsync​

AvatarSdk.EquipWearableAsync(ManagedAvatar, WearableAssetInfo, [System.Threading.CancellationToken]);

Equips a Wearable by wearable asset info on the specified avatar.

UnEquipWearableAsync​

AvatarSdk.UnEquipWearableAsync(ManagedAvatar, WearableAssetInfo, [System.Threading.CancellationToken]);

Unequips a Wearable by wearable ID from the specified avatar.

EquipWearableByWearableIdAsync​

AvatarSdk.EquipWearableByWearableIdAsync(ManagedAvatar, string, [System.Threading.CancellationToken]);

Equips a Wearable by wearable ID on the specified avatar.

UnEquipWearableByWearableIdAsync​

AvatarSdk.UnEquipWearableByWearableIdAsync(ManagedAvatar, string, [System.Threading.CancellationToken])

Unequips a Wearable by wearable ID from the specified avatar.

Makeup​

GetDefaultMakeupByCategoryAsync​

AvatarSdk.GetDefaultMakeupByCategoryAsync(AvatarMakeupCategory, [System.Threading.CancellationToken]);

Gets the default makeup assets (List<AvatarMakeupInfo>) filtered by category from the default inventory service.

EquipMakeupAsync​

AvatarSdk.EquipMakeupAsync(ManagedAvatar, AvatarMakeupInfo, [System.Threading.CancellationToken]);

Sets avatar makeup by equipping the asset (e.g. from GetDefaultMakeupByCategoryAsync). Uses the asset's AssetId.

UnEquipMakeupAsync​

AvatarSdk.UnEquipMakeupAsync(ManagedAvatar, AvatarMakeupInfo, [System.Threading.CancellationToken]);

Unequips a makeup asset from the specified avatar using the given AvatarItemInfo's AssetId.

Hair​

GetDefaultHairAssets​

AvatarSdk.GetDefaultHairAssets(HairType, [System.Threading.CancellationToken]);

Gets default hair wearable assets (List<WearableAssetInfo>) for the given hair type.

EquipHairAsync​

AvatarSdk.EquipHairAsync(ManagedAvatar, WearableAssetInfo, [System.Threading.CancellationToken]);

Equips a hair style on the specified avatar. Supports both regular hair and facial hair.

EquipHairByHairAssetIdAsync​

AvatarSdk.EquipHairByHairAssetIdAsync(ManagedAvatar, string, [System.Threading.CancellationToken]);

Equips a hair style given the hair asset ID string on the specified avatar. Supports both regular hair and facial hair.

UnEquipHairAsync​

AvatarSdk.UnEquipHairAsync(ManagedAvatar, HairType, [System.Threading.CancellationToken]);

Unequips a hair style from the specified avatar. Automatically finds the currently equipped hair asset and unequips it. Supports both regular hair and facial hair.

Tattoos​

GetDefaultTattoosAsync​

AvatarSdk.GetDefaultTattoosAsync([System.Threading.CancellationToken]);

Gets default tattoo assets (List<AvatarTattooInfo>)from the default inventory service (image library category "Tattoos").

EquipTattooAsync​

AvatarSdk.EquipTattooAsync(ManagedAvatar, AvatarTattooInfo, MegaSkinTattooSlot, [System.Threading.CancellationToken]);

Equips a tattoo on the specified avatar at the given slot using AvatarItemInfo (e.g. from GetDefaultTattoosAsync).

UnEquipTattooAsync​

AvatarSdk.UnEquipTattooAsync(ManagedAvatar, MegaSkinTattooSlot, [System.Threading.CancellationToken]);

Unequips a tattoo from the specified avatar at the given slot.

Colors​

There are several "create" methods that are color factory helpers when setting a color for hair, skin, eyebrows, eyelashes, eyes, and makeup.

CreateHairColor​

AvatarSdk.CreateHairColor(Color, Color, Color, Color);

A HairColor instance that can be passed to SetColorAsync. It requires a base color and color for R, G, B.

CreateFacialHairColor​

FacialHairColor AvatarSdk.CreateFacialHairColor(Color, Color, Color, Color);

Creates a FacialHairColor instance for use with SetColorAsync. It requires a base color and color for R, G, B.

CreateEyeBrowsColor​

EyeBrowsColor AvatarSdk.CreateEyeBrowsColor(Color, Color);

Creates an EyeBrowsColor instance for use with SetColorAsync. It requires a first and second base color.

CreateEyeLashColor​

EyeLashColor AvatarSdk.CreateEyeLashColor(Color, Color);

Creates an EyeLashColor instance for use with SetColorAsync. It requires a first and second base color.

CreateSkinColor​

SkinColor AvatarSdk.CreateSkinColor(Color);

Creates a SkinColor instance for use with SetColorAsync. It requires a base color.

CreateMakeupColor​

AvatarSdk.CreateMakeupColor(AvatarMakeupCategory, Color, Color, Color, Color);

Creates a MakeupColor instance for use with SetColorAsync. It requires a makeup category, base color, and color for R, G, B.

GetColorAsync​

AvatarSdk.GetColorAsync(ManagedAvatar, AvatarColorKind, [System.Threading.CancellationToken]);

Gets the current color (IAvatarColor) from the avatar for the specified color kind (Hair, FacialHair, EyeBrows, EyeLash, Skin, Eyes, Makeup categories).

note

For certain categories, this method will only work reliably after a SetColor call has been call on the avatar once.

GetDefaultColorsAsync​

AvatarSdk.GetDefaultColorsAsync(ColorType, [System.Threading.CancellationToken]);

Gets default (curated) color presets (List<IAvatarColor>) for the specified color type.

GetUserColorsAsync​

AvatarSdk.GetUserColorsAsync(UserColorType, [System.Threading.CancellationToken]);

Gets user (custom) color presets (List<IAvatarColor>) for the specified color type.

note

Only Hair and Skin support custom colors.

SetColorAsync​

AvatarSdk.SetColorAsync(ManagedAvatar, IAvatarColor, [System.Threading.CancellationToken]);

Sets hair, eyebrow, eyelash, skin, or eye color on the avatar. Use CreateHairColor, CreateSkinColor, etc. to build the color.

Avatar Base and Facial Features​

GetDefaultAvatarFeaturesByCategory​

AvatarSdk.GetDefaultAvatarFeaturesByCategory(AvatarFeatureCategory, [System.Threading.CancellationToken]);

Gets default avatar feature data (List<AvatarFeaturesInfo>) filtered by category from the default inventory service.

SetAvatarFeatureAsync​

AvatarSdk.SetAvatarFeatureAsync(ManagedAvatar, AvatarFeaturesInfo, [System.Threading.CancellationToken]);

Sets an avatar feature by equipping the specified asset. Provides a unified interface for modifying various facial features.

Avatar Feature Stats​

GetAvatarFeatureStats​

AvatarSdk.GetAvatarFeatureStats(ManagedAvatar, AvatarFeatureStatType);

Gets current values (Dictionary<AvatarFeatureStat, float>) for a given avatar feature stat type (e.g. all nose stats, all body stats).

ModifyAvatarFeatureStat​

AvatarSdk.ModifyAvatarFeatureStat(ManagedAvatar, AvatarFeatureStat, float, [System.Threading.CancellationToken]);

Modifies a single avatar feature stat. Value is clamped to -1.0..1.0.

ModifyAvatarFeatureStats​

bool AvatarSdk.ModifyAvatarFeatureStats(ManagedAvatar, Dictionary<AvatarFeatureStat, float>, [System.Threading.CancellationToken]);

Modifies multiple avatar feature stats at once. Values are clamped to -1.0..1.0.

Grant an Asset​

GiveAssetToUserAsync​

AvatarSdk.GiveAssetToUserAsync(string);

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.

tip

This is used for custom wearables created by developers.

Check out the Reward Users with Custom Wearables tutorial for more information.

caution

Anonymous users cannot be granted custom wearables. This is because anonymous users do not have access to Genies servers and adding a custom wearable to a user's inventory requires using Genies servers.

Set Body Type​

SetAvatarBodyTypeAsync​

AvatarSdk.SetAvatarBodyTypeAsync(ManagedAvatar, GenderType, BodySize, CancellationToken);

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

Save Avatar Definition​

SaveAvatarDefinitionLocallyAsync​

AvatarSdk.SaveAvatarDefinitionLocallyAsync(ManagedAvatar, string);

This function saves a given Avatar's definition to both a local JSON file for persistent data and a scriptable GameObject in the Assets > Genies > AvatarEditor > Profiles > Resources folder. It uses the given string as a profile ID.

SaveUserAvatarDefinitionAsync​

AvatarSdk.SaveUserAvatarDefinitionAsync(ManagedAvatar);

Saves the current avatar definition to the user's avatar.