Color Selection Element

The ColorSelection element lets your users choose a color for an asset category, such as the eyes or hairstyle, or the avatar's skin tone.

Usage

After placing the ColorSelectionElement in your Hierarchy, you can access the ColorSelectionElement script's public methods to load assets and manage their selection.

To load the assets, you need to call the LoadAndCreateButtons method. It requires the AvatarProperties, because avatars created from a selfie have an additional estimated color in the list. You can get the AvatarProperties from the AvatarManager, when you first load the avatar.

public async Task LoadAndCreateButtons(AvatarProperties avatarProperties);

When an asset button is clicked, the ColorSelectionElement fires a UnityEvent. The IAssetData contains all the information needed for the AvatarManager to update and load the new avatar.

public UnityEvent<IAssetData> OnAssetSelected;

Customizing

Customizing the ColorSelectionElement is very similar to adapting the AssetSelectionElement. See Asset Selection Element.

Last updated