Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AssetManager

A per-context singleton that manages all of an app's assets. Create a new asset group by calling a load method (e.g. loadGltf), view the group's assets via groups, and use the assets by ID on actors (e.g. Actor.CreateFromPrefab).

Hierarchy

  • AssetManager

Index

Properties

context

context: Context

Accessors

assets

  • get assets(): object

groups

  • get groups(): object

manualGroup

ready

  • get ready(): Promise<void>
  • Returns Promise<void>

    A promise that resolves when all pending asset load requests have been settled, successfully or otherwise. Listen to the individual load promises to catch failures.

Methods

assetLoaded

  • assetLoaded(assetId: string): Promise<void>
  • A promise that resolves when a specific asset has settled, successfully or otherwise

    Parameters

    • assetId: string

      The asset's id

    Returns Promise<void>

cleanup

  • cleanup(): void

createMaterial

createSound

createTexture

loadGltf

  • Load the assets in a glTF model by URL, and populate a new group with the result.

    Parameters

    • groupName: string

      The name of the group to create.

    • uri: string

      The URI to a glTF model.

    • Default value colliderType: CreateColliderType = "none"

    Returns Promise<AssetGroup>

    The promise of a new asset group.

unloadAsset

  • unloadAsset<T>(asset: T): void