dropSceneInstance

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

Releases the resources held by a SceneInstance as it leaves an ECS entity.

ScenePlugin installs this function as the remove callback in ComponentHooks for SceneInstance. The hook reads the component while it is available to release its live asset handles.

When the component is present, the hook removes the entity from the SceneSpawner entry for sceneInstance.handle.id(), then calls Handle#drop on the scene handle and, when present, the filter handle. These calls queue the handles for deferred release.

A stale entity or an entity without a SceneInstance is a no-op. The hook does not remove the component, despawn the entity, or remove any already spawned scene descendants.

Examples

// ScenePlugin installs this hook for SceneInstance automatically.
world.remove(instanceEntity, [SceneInstance])
// The pending spawn is cancelled and both live handles are released.

Parameters

NameDescriptionDefault
entity

Entity whose SceneInstance component is being removed.

—
world

World that owns the entity, component, and SceneSpawner resource.

—