ResourceManager
Manager for resources.
Resources are accessed via the engine they belong to.
See: textures, meshes, and materials.
- ResourceManager
- .allocatedCount
- .count
- .engine
- .all() ⇒ T[]
- .get(index) ⇒ null | T
- .loadedFromScene(prefab) ⇒ T[]
- .wrap(index) ⇒ null | T
.allocatedCount: number
Number of textures allocated in the manager.
.count: number
Number of resources in the manager.
Note: For performance reasons, avoid calling this method when possible.
.engine: WonderlandEngine
Hosting engine instance.
.all() ⇒ T[]
1.5.0+Retrieves non-destroyed resources.
To retrieve resources loaded by a specific scene, use loadedFromScene.
Example
Returns: Array of all resources.
.get(index: number) ⇒ null | T
Retrieve the resource at the given index.
Note: The index is relative to the host, i.e., doesn’t pack the host index.
| Param | Type | Description |
|---|---|---|
| index | number |
.loadedFromScene(prefab: Prefab) ⇒ T[]
1.5.0+Return all resources loaded from a given scene
Note: Resources created at runtime are retrieved using:
Returns: Array of resources loaded from the given prefab.
| Param | Type | Description |
|---|---|---|
| prefab | Prefab | The prefab |
.wrap(index: number) ⇒ null | T
Wrap the index into a resource instance.
Note: The index is relative to the host, i.e., doesn’t pack the host index (if any).
Returns:
| Param | Type | Description |
|---|---|---|
| index | number | The resource index. |