PlayEmote

Method

Play an emote on the avatar (Defined by the SpatialAvatarAnimation component)

Definition

void PlayEmote(AssetType assetType, string assetID, bool immediately = false, bool loop = false)
void PlayEmote(AssetType assetType, string assetID, bool immediately = false, bool loop = false)

Parameters

ParameterDescription
AssetType assetType

Which asset type to play this from. For BackpackItem, this will only work if the user owns that item

string assetID

ID of the asset:

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

Play the emote immidiately, without any transitions. Ignored when assetType is BackpackItem

bool loop

Loop the animation until it is stopped. Ignored when assetType is BackpackItem

Examples

public void StartSwimming()
{
// Play the swim animation on the local actor's avatar
SpatialBridge.actorService.localActor.avatar.PlayEmote(AssetType.EmbeddedAsset, "SwimAnimation", immediately: true, loop: true);
}

public void StopSwimming()
{
SpatialBridge.actorService.localActor.avatar.StopEmote();
}
public void StartSwimming()
{
// Play the swim animation on the local actor's avatar
SpatialBridge.actorService.localActor.avatar.PlayEmote(AssetType.EmbeddedAsset, "SwimAnimation", immediately: true, loop: true);
}

public void StopSwimming()
{
SpatialBridge.actorService.localActor.avatar.StopEmote();
}