API reference

ComponentRegistration Class

ComponentRegistration is used to register components when creating a SpatialFeature. It is generally used and returned in a list in the SpatialFeature.componentsToRegister() method. It is recommeded to create a ComponentRegistration using the static createConfig() method.
Example:
override fun componentsToRegister(): List<ComponentRegistration> {
  return listOf(
      ComponentRegistration.createConfig<Audio>(Audio.Companion),
      ComponentRegistration.createConfig<Video>(Video.Companion))
 }

Signature

class ComponentRegistration(
    val clazz: KClass<out ComponentBase>,
    val companionObjectInstance: ComponentCompanion,
    val sendRate: SendRate = SendRate.DEFAULT,
)

Constructors

ComponentRegistration ( clazz , companionObjectInstance , sendRate )
Signature
constructor(
    clazz: KClass<out ComponentBase>,
    companionObjectInstance: ComponentCompanion,
    sendRate: SendRate = SendRate.DEFAULT,
)
Parameters
clazz: KClass<out ComponentBase>  The Kotlin class of the component being registered
companionObjectInstance: ComponentCompanion  The companion object instance for the component, which provides metadata about the component's attributes and dependencies
sendRate: SendRate  The network synchronization rate and reliability settings for this component, determining how often and how reliably component updates are sent over the network
Returns
ComponentRegistration

Properties

clazz : KClass<out ComponentBase>
[Get]
The Kotlin class of the component being registered
Signature
val clazz: KClass<out ComponentBase>
companionObjectInstance : ComponentCompanion
[Get]
The companion object instance for the component, which provides metadata about the component's attributes and dependencies
Signature
val companionObjectInstance: ComponentCompanion
sendRate : SendRate
[Get]
The network synchronization rate and reliability settings for this component, determining how often and how reliably component updates are sent over the network
Signature
val sendRate: SendRate

Companion Object

Methods

createConfig ( companionObjectInstance , sendRate )
Creates a ComponentRegistration configuration for the specified component type. This is generally used and returned in a list in the SpatialFeature.componentsToRegister() method.
Example:
override fun componentsToRegister(): List<ComponentRegistration> {
  return listOf(
      ComponentRegistration.createConfig<Audio>(Audio.Companion),
      ComponentRegistration.createConfig<Video>(Video.Companion))
 }

Signature
inline fun <T : ComponentBase> createConfig(
    companionObjectInstance: ComponentCompanion,
    sendRate: SendRate = SendRate.DEFAULT,
): ComponentRegistration
Parameters
companionObjectInstance: ComponentCompanion  The companion object instance for the component
sendRate: SendRate  The network synchronization settings for this component
Returns
ComponentRegistration  A new ComponentRegistration instance for the specified component type