Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AssetsManager

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

constructor

  • Creates a new AssetsManager

    Parameters

    • scene: Scene

      defines the scene to work on

    Returns AssetsManager

Properties

autoHideLoadingUISearch playground for autoHideLoadingUI

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.

onFinishSearch playground for onFinish

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

Callback called when all tasks are processed

Type declaration

onProgressSearch playground for onProgress

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

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

Type declaration

onProgressObservableSearch playground for onProgressObservable

onProgressObservable: Observable<IAssetsProgressEvent>

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

onTaskErrorSearch playground for onTaskError

onTaskError: (task: AbstractAssetTask) => void

Callback called when a task had an error

Type declaration

onTaskErrorObservableSearch playground for onTaskErrorObservable

onTaskErrorObservable: Observable<AbstractAssetTask>

Observable called when a task had an error

onTaskSuccessSearch playground for onTaskSuccess

onTaskSuccess: (task: AbstractAssetTask) => void

Callback called when a task is successful

Type declaration

onTaskSuccessObservableSearch playground for onTaskSuccessObservable

onTaskSuccessObservable: Observable<AbstractAssetTask>

Observable called when all tasks are processed

onTasksDoneObservableSearch playground for onTasksDoneObservable

onTasksDoneObservable: Observable<AbstractAssetTask[]>

Observable called when all tasks were executed

useDefaultLoadingScreenSearch playground for useDefaultLoadingScreen

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

addBinaryFileTaskSearch playground for addBinaryFileTask

  • 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

addContainerTaskSearch playground for addContainerTask

  • 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

addCubeTextureTaskSearch playground for addCubeTextureTask

  • 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

addEquiRectangularCubeTextureAssetTaskSearch playground for addEquiRectangularCubeTextureAssetTask

  • 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

addHDRCubeTextureTaskSearch playground for addHDRCubeTextureTask

  • 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

addImageTaskSearch playground for addImageTask

  • 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

addMeshTaskSearch playground for addMeshTask

  • 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

addTextFileTaskSearch playground for addTextFileTask

  • 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

addTextureTaskSearch playground for addTextureTask

  • 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

loadSearch playground for load

  • Start the loading process

    Returns AssetsManager

    the current instance of the AssetsManager

loadAsyncSearch playground for loadAsync

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

    Returns Promise<void>

    a promise returning the list of failed tasks

removeTaskSearch playground for removeTask

  • Remove a task from the assets manager.

    Parameters

    Returns void

resetSearch playground for reset

  • Reset the AssetsManager and remove all tasks

    Returns AssetsManager

    the current instance of the AssetsManager

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method