constructor(type: object)
View sourceCreates a typed asset pool for values identified by type.
The supplied constructor is retained as the asset family’s type identity for handles and resource access.
Class
ExtendsAssets
Typed resource alias for the shared Assets pool of Scene
assets. It inherits Assets behavior for adding scenes with
Assets#add and resolving handles with Assets#get or
Assets#getByAssetId.
Retrieve the shared pool with world.getResource and SceneAssets.
A SceneInstance can store a handle from this pool for scene
restoration.
import { Scene, SceneAssets, SceneInstance } from '@wimaengine/scene'
// `world` provides the shared SceneAssets pool.
const scenes = world.getResource(SceneAssets)
const sceneHandle = scenes.add(new Scene())
const instanceEntity = world.spawn([
new SceneInstance(sceneHandle)
])
// The handle identifies the scene in this shared pool.
console.log(scenes.get(sceneHandle) !== undefined, instanceEntity.id())constructor(type: object)Creates a typed asset pool for values identified by type.
The supplied constructor is retained as the asset family’s type identity for handles and resource access.