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

SystemManager

SystemManager

class SystemManager
Manages the lifecycle and execution of systems within the Spatial SDK.
SystemManager is responsible for organizing, prioritizing, and executing systems in a deterministic order based on their dependencies. It maintains a directed acyclic graph (DAG) of systems to ensure proper execution order and handles system registration, discovery, and lifecycle management.
Systems can be registered with different priority groups (EARLY, NORMAL, LATE) to control their relative execution order. The manager ensures systems are executed in topologically sorted order based on their dependencies and priority groups.
Example usage:
// Register a system
systemManager.registerSystem(MyCustomSystem())

// Find a system by class
val avatarSystem = systemManager.findSystem<AvatarSystem>()
The SystemManager is created and managed by AppSystemActivity or other activity classes that extend from VrActivity.

Constructors

NameSummary
SystemManager
constructor()

Functions

NameSummary
findSystem
inline fun <T : SystemBase> findSystem(): T

Finds a system by its type using reified type parameters.



fun <T : SystemBase> findSystem(clazz: KClass<T>): T

Finds a system by its class.
getScene
fun getScene(): Scene

Returns the scene associated with the manager.
registerEarlySystem
fun registerEarlySystem(system: SystemBase)

Registers an early system that will be executed before other systems.
registerLateSystem
fun registerLateSystem(system: SystemBase)

Registers a late system that will be executed after other systems.
registerSystem
fun registerSystem(system: SystemBase)

Adds a system to the manager, which will be called for all operations.
setEarlySystems
fun setEarlySystems(earlySystems: List<SystemBase>)

Sets the early systems in the manager.
setLateSystems
fun setLateSystems(lateSystems: List<SystemBase>)

Sets the late systems in the manager.
tryFindSystem
inline fun <T : SystemBase> tryFindSystem(): T?

Tries to find a system by its type using reified type parameters.



fun <T : SystemBase> tryFindSystem(clazz: KClass<T>): T?

Tries to find a system by its class.
unregisterSystem
inline fun <T : SystemBase> unregisterSystem()

Unregisters a system by its type using reified type parameters.



fun <T : SystemBase> unregisterSystem(clazz: KClass<T>)

Unregisters a system from the manager.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon