SpawnAvatar

Method

Spawns an NPC avatar, owned by the local actor and visible to all other actors. This object will remain alive in the server until explicitly destroyed (or the server instance was shut down). The ownership of this object can be transferred to another actor if requested, and by default the ownership is transferred to the master client when the owner disconnects.

Definition

SpawnAvatarRequest SpawnAvatar(AssetType assetType, string assetID, Vector3 position, Quaternion rotation, string displayName)
SpawnAvatarRequest SpawnAvatar(AssetType assetType, string assetID, Vector3 position, Quaternion rotation, string displayName)

Returns SpawnAvatarRequest

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
Vector3 position

Initial position of the avatar

Quaternion rotation

Initial facing direction of the avatar (this will always be corrected to Y-up).

string displayName

The name in the avatar's nametag