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
  • Fetch an asset by id.

    Returns object

groups

  • get groups(): object
  • Fetch a group by name.

    Returns object

manualGroup

  • Get the group of individually-created assets

    Returns AssetGroup

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

cleanup

  • cleanup(): void
  • Returns void

createMaterial

  • Generate a new material

    Parameters

    • name: string

      The new material's name

    • definition: Partial<MaterialLike>

      The initial material properties

    Returns ForwardPromise<Material>

createTexture

  • Generate a new texture

    Parameters

    • name: string

      The new texture's name

    • definition: Partial<TextureLike>

      The initial texture properties. The uri property is required.

    Returns ForwardPromise<Texture>

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.