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

AppSystemCommon Interface

This interface is used to provide a common interface for both AppSystemActivities and AppSystemServices. It provides access to the SystemManager and allows for registering mesh creators.

Signature

interface AppSystemCommon

Methods

getSystemManager ()
Signature
abstract fun getSystemManager(): SystemManager
registerAsyncMeshCreator ( baseUrl , creator )
Registers an async mesh creator for a base URL pattern.
Unlike AppSystemCommon.registerMeshCreator, the creator function will be invoked on a background thread. The resulting SceneMesh will be attached to the entity on the main thread. This is suitable for mesh creators that perform expensive computation (e.g., procedural geometry generation).
The creator will be invoked for any mesh URI that matches the base URL (scheme + authority + path). Query parameters from the full URI will be passed to the creator for customization.
Parameters
baseUrl: String  The base URL to match (e.g., "mesh://myapp/custom"). Query parameters are ignored in matching.
creator: SuspendFunction2  Function that takes an Entity and the full URI (including query params), returns a SceneMesh. Called on a background thread.
registerMeshCreator ( baseUrl , creator )
Registers a mesh creator for a base URL pattern.
The creator will be invoked for any mesh URI that matches the base URL (scheme + authority + path). Query parameters from the full URI will be passed to the creator for customization.
Example:
// Register a creator for "mesh://custom/sphere"
registerMeshCreator("mesh://custom/sphere") { entity, uri ->
    val radius = uri.getQueryParameter("radius")?.toFloatOrNull() ?: 1.0f
    val color = uri.getQueryParameter("color") ?: "white"
    createSphere(entity, radius, color)
}
// Later, use with parameters:
Mesh(Uri.parse("mesh://custom/sphere?radius=2.5&color=red"))

Parameters
baseUrl: String  The base URL to match (e.g., "mesh://myapp/custom"). Query parameters are ignored in matching.
creator: Function2  Function that takes an Entity and the full URI (including query params), returns a SceneMesh
registerMeshCreator ( meshURL , creator )
Registers a simple mesh creator that doesn't need URI parameters.
This is a convenience method for mesh creators that don't need to read query parameters from the URI. The mesh URL must match exactly.
Example:
registerMeshCreator("mesh://custom") { entity ->
    SceneMesh.box(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f, material)
}

Signature
open fun registerMeshCreator(meshURL: String, creator: (entity: Entity) -> SceneMesh)
Parameters
meshURL: String  The exact mesh URL to match
creator: Function1  Function that takes an Entity and returns a SceneMesh
unregisterAsyncMeshCreator ( baseUrl )
Unregisters an async mesh creator for the given base URL.
Signature
open fun unregisterAsyncMeshCreator(baseUrl: String)
Parameters
baseUrl: String  The base URL that was registered
unregisterMeshCreator ( baseUrl )
Unregisters a mesh creator for the given base URL.
Signature
open fun unregisterMeshCreator(baseUrl: String)
Parameters
baseUrl: String  The base URL that was registered