initSceneInstance

View sourceinitSceneInstance(entity: EntityHandle, world: World): void

Queues a newly added SceneInstance for deferred scene spawning.

ScenePlugin installs this function as the add callback in a ComponentHook. It looks up the instance on the entity, reads sceneInstance.handle.id(), obtains the world’s SceneSpawner, and records the scene asset ID together with the entity. The scene does not need to be loaded yet; it remains pending until its asset becomes available.

Examples

// With ScenePlugin installed, adding the component queues its scene ID.
const entity = world.spawn([new SceneInstance(sceneHandle)])
// The scene is restored later when its asset becomes available.

Parameters

NameDescriptionDefault
entity

Entity receiving the SceneInstance component.

—
world

World containing the SceneSpawner resource and component.

—