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

ComposeViewPanelRegistration Class

Modifiers: final
Panel registration for Jetpack Compose-based panels.
This class simplifies the creation of panels using Jetpack Compose by providing a direct ComposeView creator function. It gives full control over ComposeView creation while still handling proper lifecycle management automatically.
Use this when:
  • You want to create panels with Jetpack Compose UI but without an Activity
  • You want to share the Viewmodel with the base immersive activity so communication between 3D and compose view is easier

Signature

class ComposeViewPanelRegistration(val registrationId: Int, composeViewCreator: (entity: Entity, <Error class: unknown class>) -> <Error class: unknown class>, settingsCreator: (entity: Entity) -> PanelSettings, panelSetupWithComposeView: (<Error class: unknown class>, PanelSceneObject, Entity) -> Unit = { _, _, _ ->
        }) : PanelRegistration

Constructors

ComposeViewPanelRegistration ( registrationId , composeViewCreator , settingsCreator , panelSetupWithComposeView )
Signature
constructor(registrationId: Int, composeViewCreator: (entity: Entity, <Error class: unknown class>) -> <Error class: unknown class>, settingsCreator: (entity: Entity) -> PanelSettings, panelSetupWithComposeView: (<Error class: unknown class>, PanelSceneObject, Entity) -> Unit = { _, _, _ ->
        })
Parameters
registrationId: Int
Unique identifier for this panel registration
composeViewCreator: Function2
Function that creates a ComposeView for each panel instance, receiving both the entity and context for maximum flexibility in ComposeView creation
settingsCreator: Function1
Function that creates PanelSettings for each panel instance, allowing dynamic panel configuration (size, position, etc.)
panelSetupWithComposeView: Function3
Optional setup function called after panel creation with access to the ComposeView, PanelSceneObject, and Entity for additional configuration

Properties

activityClass : Class?
[Get][Set]
Activity class if the panel is powered by an activity and its layout/logic.
Signature
var activityClass: Class<*>?
init : Function2
[Get]
Signature
val init: PanelRegistration.(entity: Entity) -> Unit
layoutResourceId : Int?
[Get][Set]
Layout resource id if the panel is view-based and created in the same immersive activity.
Signature
var layoutResourceId: Int?
panelConfigOptions2 : Function2?
[Get][Set]
Signature
var panelConfigOptions2: PanelConfigOptions2.(entity: Entity) -> PanelConfigOptions2?
panelIntent : Intent?
[Get][Set]
Intent to launch the panel's activity if the panel is activity-based.
Signature
var panelIntent: Intent?
registrationId : Int
[Get]
Signature
val registrationId: Int

Functions

config ( overriding , block )
Signature
fun config(overriding: Boolean = true, block: PanelConfigOptions.() -> Unit): PanelRegistration
Parameters
overriding: Boolean
block: Function1
fromConfigOptions2 ( panelConfigOptions2 )
Signature
infix fun fromConfigOptions2(panelConfigOptions2: PanelConfigOptions2.(entity: Entity) -> PanelConfigOptions2): PanelRegistration
Parameters
panelConfigOptions2: Function2
panel ( overriding , block )
Signature
fun panel(overriding: Boolean = true, block: PanelSceneObject.() -> Unit): PanelRegistration
Parameters
overriding: Boolean
block: Function1
panelComponent ()
Returns the Panel component that will be used to create the panel entity.
Signature
fun panelComponent(): Panel
Returns
panelCreator ( scene , spatialContext )
Returns a function that takes an entity as input and returns a PanelSceneObject. This function will be used to create the panel scene object in PanelCreationSystem. Whenever you create Entity with Panel(registrationId) component, this function will be called to create the panel scene object.
Signature
open override fun panelCreator(scene: Scene, spatialContext: SpatialContext): (entity: Entity) -> PanelSceneObject
Parameters
scene: Scene
The scene in which the panel will be created.
spatialContext: SpatialContext
The spatial context of the panel.
Returns
Function1
A function that takes an entity as input and returns a PanelSceneObject.
view ( block )
Signature
fun view(block: (<Error class: unknown class>) -> <Error class: unknown class>): PanelRegistration
Parameters
block: Function1
Did you find this page helpful?