Options
All
  • Public
  • Public/Protected
  • All
Menu

This class can be used to easily import assets into a scene

see

https://doc.babylonjs.com/how_to/how_to_use_assetsmanager

Hierarchy

  • AssetsManager

Index

Constructors

  • Creates a new AssetsManager

    Parameters

    • Optional scene: Scene

      defines the scene to work on

    Returns AssetsManager

Properties

autoHideLoadingUI: boolean

Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen when all assets have been downloaded. If set to false, you need to manually call in hideLoadingUI() once your scene is ready.

onFinish: (tasks: AbstractAssetTask[]) => void

Type declaration

onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void

Type declaration

    • Callback called when a task is done (whatever the result is)

      Parameters

      Returns void

onProgressObservable: Observable<IAssetsProgressEvent>

Observable called when a task is done (whatever the result is)

onTaskError: (task: AbstractAssetTask) => void

Type declaration

onTaskErrorObservable: Observable<AbstractAssetTask>

Observable called when a task had an error

onTaskSuccess: (task: AbstractAssetTask) => void

Type declaration

onTaskSuccessObservable: Observable<AbstractAssetTask>

Observable called when all tasks are processed

onTasksDoneObservable: Observable<AbstractAssetTask[]>

Observable called when all tasks were executed

useDefaultLoadingScreen: boolean

Gets or sets a boolean defining if the AssetsManager should use the default loading screen

see

https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen

Methods

  • Add a BinaryFileAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • url: string

      defines the url of the file to load

    Returns BinaryFileAssetTask

    a new BinaryFileAssetTask object

  • addContainerTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File): ContainerAssetTask
  • Add a ContainerAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • meshesNames: any

      defines the name of meshes to load

    • rootUrl: string

      defines the root url to use to locate files

    • sceneFilename: string | File

      defines the filename of the scene file or the File itself

    Returns ContainerAssetTask

    a new ContainerAssetTask object

  • addCubeTextureTask(taskName: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[], prefiltered?: boolean): CubeTextureAssetTask
  • Add a CubeTextureAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • url: string

      defines the url of the file to load

    • Optional extensions: string[]

      defines the extension to use to load the cube map (can be null)

    • Optional noMipmap: boolean

      defines if the texture must not receive mipmaps (false by default)

    • Optional files: string[]

      defines the list of files to load (can be null)

    • Optional prefiltered: boolean

      defines the prefiltered texture option (default is false)

    Returns CubeTextureAssetTask

    a new CubeTextureAssetTask object

  • Add a EquiRectangularCubeTextureAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • url: string

      defines the url of the file to load

    • size: number

      defines the size you want for the cubemap (can be null)

    • Optional noMipmap: boolean

      defines if the texture must not receive mipmaps (false by default)

    • Optional gammaSpace: boolean

      Specifies if the texture will be used in gamma or linear space (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)

    Returns EquiRectangularCubeTextureAssetTask

    a new EquiRectangularCubeTextureAssetTask object

  • addHDRCubeTextureTask(taskName: string, url: string, size: number, noMipmap?: boolean, generateHarmonics?: boolean, gammaSpace?: boolean, reserved?: boolean): HDRCubeTextureAssetTask
  • Add a HDRCubeTextureAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • url: string

      defines the url of the file to load

    • size: number

      defines the size you want for the cubemap (can be null)

    • Optional noMipmap: boolean

      defines if the texture must not receive mipmaps (false by default)

    • Optional generateHarmonics: boolean

      defines if you want to automatically generate (true by default)

    • Optional gammaSpace: boolean

      specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)

    • Optional reserved: boolean

      Internal use only

    Returns HDRCubeTextureAssetTask

    a new HDRCubeTextureAssetTask object

  • Add a ImageAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • url: string

      defines the url of the file to load

    Returns ImageAssetTask

    a new ImageAssetTask object

  • addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File): MeshAssetTask
  • Add a MeshAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • meshesNames: any

      defines the name of meshes to load

    • rootUrl: string

      defines the root url to use to locate files

    • sceneFilename: string | File

      defines the filename of the scene file or the File itself

    Returns MeshAssetTask

    a new MeshAssetTask object

  • Add a TextFileAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • url: string

      defines the url of the file to load

    Returns TextFileAssetTask

    a new TextFileAssetTask object

  • addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): TextureAssetTask
  • Add a TextureAssetTask to the list of active tasks

    Parameters

    • taskName: string

      defines the name of the new task

    • url: string

      defines the url of the file to load

    • Optional noMipmap: boolean

      defines if the texture must not receive mipmaps (false by default)

    • Optional invertY: boolean

      defines if you want to invert Y axis of the loaded texture (false by default)

    • Optional samplingMode: number

      defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)

    Returns TextureAssetTask

    a new TextureAssetTask object

  • Start the loading process

    Returns AssetsManager

    the current instance of the AssetsManager

  • loadAsync(): Promise<void>
  • Start the loading process as an async operation

    Returns Promise<void>

    a promise returning the list of failed tasks

  • Remove a task from the assets manager.

    Parameters

    Returns void

  • Reset the AssetsManager and remove all tasks

    Returns AssetsManager

    the current instance of the AssetsManager

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited constructor
  • Static method

Settings

Theme