ILocalActor

Actor Service

Interface

The local actor (user on the current machine).

Properties

avatar

The avatar for the local actor (the local user).

This will never be null, even if the avatar for the local user was hidden or disabled. However, if hasAvatar is false, all calls to avatar methods and properties will be no-ops.

Unlike avatar, this reference will always point to the current avatar for the local actor, even if the assigned avatar changes.

Methods

RemoveCustomProperty(string)

Remove a custom property for this actor.

SetCustomProperty(string, object)

Set a custom property for this actor. These properties are synchronized across all clients. An actor's properties are only cleared if they leave the space. Teleporting between servers of the same space will not clear the properties. Supported types: int, bool, float, Vector2, Vector3, string, Color32, byte, double, long, int[]

Inherited Members

GetProfilePicture()

Get the profile picture texture for the actor.

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.

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.

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.

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.

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;
}