# RealtimeAvatarManager

RealtimeAvatarManager is a component that managers VR & AR avatars. It will automatically spawn a prefab for each player that joins a room. Avatar prefabs will automatically use Unity’s native XR APIs for getting the head & hand positions, however you can also specify your own transforms.

Note: This component must be on the same game object as Realtime.

# Editor Interface

Local Avatar Prefab: The prefab to instantiate when the local player successfully connects to a room.

Local Player: The transforms to use to position the player prefab at runtime. If you leave any of these blank, the default Unity XR APIs will be used.

Properties

Dictionary<int, RealtimeAvatar> avatars

Dictionary<int, RealtimeAvatar> Normal.Realtime.RealtimeAvatarManager.avatars

A dictionary of all RealtimeAvatar instances in the room organized by the clientID of each player.

RealtimeAvatar localAvatar

RealtimeAvatar Normal.Realtime.RealtimeAvatarManager.localAvatar

The RealtimeAvatar instance that was instantiated for the local player upon connecting to the room.

GameObject localAvatarPrefab

GameObject Normal.Realtime.RealtimeAvatarManager.localAvatarPrefab

Methods

delegate void AvatarCreatedDestroyed (RealtimeAvatarManager avatarManager, RealtimeAvatar avatar, bool isLocalAvatar)

delegate void Normal.Realtime.RealtimeAvatarManager.AvatarCreatedDestroyed

void CreateAvatarIfNeeded ()

void Normal.Realtime.RealtimeAvatarManager.CreateAvatarIfNeeded

void DestroyAvatarIfNeeded ()

void Normal.Realtime.RealtimeAvatarManager.DestroyAvatarIfNeeded

RealtimeAvatar.DeviceType GetRealtimeAvatarDeviceTypeForLocalPlayer ()

static RealtimeAvatar.DeviceType Normal.Realtime.RealtimeAvatarManager.GetRealtimeAvatarDeviceTypeForLocalPlayer

Events

AvatarCreatedDestroyed avatarCreated

AvatarCreatedDestroyed Normal.Realtime.RealtimeAvatarManager.avatarCreated

AvatarCreatedDestroyed avatarDestroyed

AvatarCreatedDestroyed Normal.Realtime.RealtimeAvatarManager.avatarDestroyed