API reference
API reference
Select your platform
No SDKs available
No versions available

SceneObjectSystem

SceneObjectSystem

class SceneObjectSystem : SystemBase
System to manage SceneObjects. This acts as a registry for other systems to get the SceneObject associated with an entity.
Example using SceneObjectSystem to get a SceneObject and adding an input listener:
systemManager.findSystem<SceneObjectSystem>().getSceneObject(myEntity)?.thenAccept { so -> so.addInputListener(myInputListener) }
Note on the example above: You will likely get null if you call ‘getSceneObject()’ immediately after attaching a Mesh component to an entity. You will likely need to call this in a System to ensure MeshCreationSystem has run by leveraging com.meta.spatial.core.SystemBase getDependencies function.

Constructors

NameSummary
SceneObjectSystem
constructor()

Properties

NameSummary
systemManager
lateinit var systemManager: SystemManager

The system manager that this system is associated with.

Functions

NameSummary
addSceneObject
fun addSceneObject(entity: Entity, sceneObjectFuture: CompletableFuture<SceneObject>)

Adds a SceneObject future to the registry to allow other systems to get the SceneObject associated with the entity. The future is expected to be completed by the caller once the SceneObject is done loading.
associateSystemManager
fun associateSystemManager(systemManager: SystemManager)

Associates this system with a system manager, used in the Spatial SDK.
delete
open override fun delete(entity: Entity)

System should do any housekeeping based on entity being removed from the scene
destroy
open fun destroy()

System should clean up any and all resources for shutdown
equals
open operator override fun equals(other: Any?): Boolean

Checks if this system is equal to another object.
execute
open override fun execute()

System should perform all the operations based on relevant entities.
getDependencies
open fun getDependencies(): SystemDependencies?

Returns the dependencies of this system.
getScene
fun getScene(): Scene

Returns the scene that this system is associated with.
getSceneObject
fun getSceneObject(entity: Entity): CompletableFuture<SceneObject>?

Returns a future for the SceneObject associated with the entity. A null return represents no load has started for this Entity.
hashCode
open override fun hashCode(): Int

Returns the hash code of this system.
removeSceneObject
fun removeSceneObject(entity: Entity)

Remove a SceneObject from the registry.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon