IActorService

Actor Service

Interface

Service for interacting with actors and users in the space.

Remarks

Actor Service

Properties

actorCount

Number of fully joined actors in the current server instance.

actors

A dictionary of all actors in the current server instance, keyed by actor number.

localActor

The local actor (user on the current machine).

localActorNumber

The actor number of the local actor (user on the current machine). This changes whenever the local user joins a new server instance (or disconnects and reconnects to the same server instance).

pendingActorCount

Number of actors that have joined the current server instance, but have not yet fully synchronized yet.

Methods

TryGetRandomActor(bool, out IActor)

Return a random actor currently in the space. This will fail if you're not connected to a server instance.

Events

onActorJoined

Event that is triggered initially upon connection for all actors who are in the server, and then when a new actor joins the server.

onActorLeft

Event that is triggered when an actor leaves the server (this can be for any reason, including disconnecting, timing out, or being kicked). The actor will still be available on the actors collection while this event is triggered.