Class
AssetSceneMap
View sourceRuntime-only World resource for scene-local asset handle mapping.
Scene#toWorld uses this map while restoring a Scene: an
AssetId for the scene asset, an asset TypeId, and a snapshot
index identify the untyped Handle associated with that scene asset.
The map is installed in the world on demand for scene restoration and is not
part of the scene snapshot itself.
Examples
// After {@linkcode Scene#toWorld} has restored a scene with an asset ID:
const sceneMap = world.getResource(AssetSceneMap)
const handle = sceneMap.get(sceneAssetId, textureTypeId, 0)
if (handle) handle.drop()
sceneMap.clear(sceneAssetId, textureTypeId)Constructor
Methods
set(sceneAssetId: AssetId, assetTypeId: TypeId, snapshotIndex: number, handle: UntypedHandle): void
View sourceget(sceneAssetId: AssetId, assetTypeId: TypeId, snapshotIndex: number): UntypedHandle
View sourceLooks up a scene-local asset handle and returns a clone of it.
The stored Handle remains in the map; the returned clone gives the
caller its own reference. Returns undefined when any part of the key is
not mapped.
clear(sceneAssetId: AssetId, assetTypeId?: TypeId): void
View sourceDrops mapped handles and removes scene-map entries.
With no asset type, drops handles for every type under the scene asset and
removes the entire scene entry. With a TypeId, only that type is
cleared; if it was the last type, its empty scene entry is removed too.
Missing scene or type entries are ignored. Each stored handle is released
through Handle#drop.
toSnapshot(): undefined
View sourceKeeps this runtime-only resource out of Scene snapshots.
