SetAvatarBody

Method

Set the avatar body to an avatar defined by SpatialAvatar component. This temporarily overrides the user's profile avatar just for this session, and can be reverted with

ResetAvatarBody

Definition

void SetAvatarBody(AssetType assetType, string assetID)
void SetAvatarBody(AssetType assetType, string assetID)

Parameters

ParameterDescription
AssetType assetType

Which asset type to set this from. BackpackItem is not supported here

string assetID

ID of the asset:

  • Package: The packageSKU found in Spatial Studio or Unity
  • EmbeddedAsset: The assetID specified in the UnitySDK.Editor.SpaceConfig in Unity Editor

Examples

public void ChangeAvatarBody()
{
// Change the user's avatar to an embedded asset avatar
SpatialBridge.actorService.localActor.avatar.SetAvatarBody(AssetType.EmbeddedAsset, "OgreAvatar");

// Change the user's avatar to a Spatial Studio avatar
SpatialBridge.actorService.localActor.avatar.SetAvatarBody(AssetType.Package, "ITEM_ID_FROM_SPATIAL_STUDIO");

// Reset the user's avatar to the default
SpatialBridge.actorService.localActor.avatar.ResetAvatarBody();
}
public void ChangeAvatarBody()
{
// Change the user's avatar to an embedded asset avatar
SpatialBridge.actorService.localActor.avatar.SetAvatarBody(AssetType.EmbeddedAsset, "OgreAvatar");

// Change the user's avatar to a Spatial Studio avatar
SpatialBridge.actorService.localActor.avatar.SetAvatarBody(AssetType.Package, "ITEM_ID_FROM_SPATIAL_STUDIO");

// Reset the user's avatar to the default
SpatialBridge.actorService.localActor.avatar.ResetAvatarBody();
}