IActor

Actor Service

Interface

An actor in the space. This represents a user who has joined the server instance.

Properties

actorNumber

The unique number of the actor in the current server instance. If an actor leaves and rejoins the server, they will be assigned a new actor number. Actor numbers are guaranteed to be unique within a server instance and start at 1. Actor number 0 is reserved for the server.

avatar

The avatar for this actor. This will be null if the actor does not have an avatar in the scene. The actor's avatar can change over time, so you should not cache this reference.

customProperties

A dictionary of custom properties for the actor. These properties are synchronized across all clients. Only actors themselves can change their own custom properties. An actor's properties are only cleared if they leave the space. Teleporting between servers of the same space will not clear the properties.

displayName

The display name for the user. This is displayed in the nametag and on the user's profile page.

hasAvatar

Returns true if the actor has an assigned avatar. This is the same as checking if avatar is not null and not disposed. This is provided as backwards compatibility with avatar where the avatar is never null, but can be disposed.

isDisposed

Whether the actor has been disposed. This will be true if the actor has left the server.

isRegistered

Does the user for this actor have a fully completed Spatial account? This will be false if the user is a guest or has not completed their account setup.

isSpaceAdministrator

Is the user for this actor an administrator of the space?

isSpaceOwner

Is the user for this actor the owner of the space?

isTalking

Is the user for this actor currently talking with voice chat? This is only true when user is un-muted and actively talking.

platform

The platform that the actor is currently using to join this space.

profileColor

The color of the actor's profile picture background.

userID

The user ID of the actor

username

The username for the public profile of the user.

Methods

GetProfilePicture()

Get the profile picture texture for the actor.

Events

onAvatarExistsChanged

Event that is triggered when the avatar for the actor is created. Because avatar can be null, this is provided as convenience to avoid having to check for null every time you want to access the avatar.

onCustomPropertiesChanged

Event that is triggered when any of the actor's custom properties change.

Examples

public TMP_Text displayName;
public TMP_Text username;
public TMP_Text userID;

public void DisplayActorData()
{
displayName.text = SpatialBridge.actorService.localActor.displayName;
username.text = SpatialBridge.actorService.localActor.username;
userID.text = SpatialBridge.actorService.localActor.userID;
}
public TMP_Text displayName;
public TMP_Text username;
public TMP_Text userID;

public void DisplayActorData()
{
displayName.text = SpatialBridge.actorService.localActor.displayName;
username.text = SpatialBridge.actorService.localActor.username;
userID.text = SpatialBridge.actorService.localActor.userID;
}