Body Shapes Selection Element

The BodyShapesSelectionElement lets the user choose between four different body shapes for their avatar.

Usage

BodyShapes is an opt-in feature for all existing applications prior to 22.04.2024. For all new applications created after this date, BodyShapes are enabled by default. Please check your Studio application settings to verify that the BodyShape toggle is enabled.

Place the BodyShapeSelectionElement prefab in your Hierarchy and access the BodyShapeSelectionElement script's public methods to load assets and manage their selection.

To load the assets, you need to call the LoadAndCreateButtons method. It will instantiate a button for each BodyShape in availableBodyShapes.

public async Task LoadAndCreateButtons();

When a body shape button is clicked, the BodyShapeSelectionElement 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

You can customize the element by exchanging the ButtonElement Prefabs to have your custom buttons, the SelectedIconPrefab to have your custom Icon and you can limit the available bodyshapes. So e.g. your application does not want to have "Plus-size" avatars, you can remove the option.

Last updated