ISpaceContentService

Space Content Service

Interface

Service for interacting with a space's synchronized content.

Properties

allObjects

A dictionary of all space objects currently in the space, keyed by ObjectID.

avatars

A dictionary of all avatar space object components in the space, keyed by ObjectID.

isSceneInitialized

True if the scene has been fully initialized.

prefabs

A dictionary of all prefab space object components in the space, keyed by ObjectID.

Methods

DestroySpaceObject(int)

Destroy the Space Object with the given ID if the local client has ownership.

GetOwnerActor(SpatialComponentBase)

Gets the actor ID of the actor that owns the spatial component.

GetSyncedObjectByID(int)

Gets a synced object by ID.

GetSyncedObjectHasControl(SpatialSyncedObject)

Gets whether or not a synced object can be modified by the local actor. This can happen when either the local actor is the owner of the synced object, or if the synced object's owner is no longer in the space and the local actor is the master client.

GetSyncedObjectID(SpatialSyncedObject)

Gets the ID of a synced object.

GetSyncedObjectIsLocallyOwned(SpatialSyncedObject)

Gets whether or not a synced object is locally owned.

GetSyncedObjectIsSynced(SpatialSyncedObject)

Gets whether or not a synced object is currently being synced.

GetSyncedObjectOwner(SpatialSyncedObject)

Gets the owner of a synced object.

SetSyncedAnimatorParameter(SpatialSyncedAnimator, string, object)

Sets a synced animator parameter.

SetSyncedAnimatorTrigger(SpatialSyncedAnimator, string)

Sets a synced animator trigger.

SpawnAvatar(AssetType, string, Vector3, Quaternion, string)

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.

SpawnPrefabObject(AssetType, string, Vector3, Quaternion)

Spawns a prefab object from a specific package uploaded thru Spatial Studio.

SpawnSpaceObject()

Spawn a space object that doesn't have any visual representation.

SpawnSpaceObject(Vector3, Quaternion)

Spawn a space object that doesn't have any visual representation.

TakeOwnership(int)

Try to take ownership of a Space Object. This can fail if the object doesn't exist or if the ownership is fixed to another actor. Since the server can reject the request, the ownership change is not immediate.

TakeoverSyncedObjectOwnership(SpatialSyncedObject)

Tries to take ownership of a synced object.

TryGetSpaceObjectID(GameObject, out int)

Try find the space object ID for a given game object in the scene. Any child game object of a visual representation of a space object can be used to retrieve the space object ID.

Events

onObjectDestroyed

Event fired when a space object is destroyed. The returned object is disposed, meaning it can not be edited, but can still be read from.

onObjectSpawned

Event fired when a space object is spawned.

onSceneInitialized

Event fired when the main space package has been fully initialized.

onSyncedObjectInitialized

Event fired when a synced object is initialized.

onSyncedObjectOwnerChanged

Event fired when a synced object's owner changes.

onSyncedObjectVariableChanged

Event fired when a synced object's variable changes.