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. |
networkObjects | A dictionary of all network objects in the space, keyed by ObjectID. |
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. |
GetOwner(ISpatialComponentWithOwner) | Gets the actor ID of the actor that owns the spatial component. |
ReleaseOwnership(int) | If the local actor is currently the owner of the object, this will release the ownership of the object
and set the owner to 0. This will not destroy the object, but it will make it available for other actors
to take ownership of.
If succeeded the |
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. |
SpawnNetworkObject(SpatialNetworkObject, Vector3?, Quaternion?) | Spawns an instance of a networked prefab in the space. |
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. |
TransferOwnership(int, int) | Transfer the ownership of an object to another actor. This will only succeed if the local actor is the owner
or
|
TryFindNetworkObject(int, out SpatialNetworkObject) | Try to find an instance of |
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. |