AbstractAssetTask

Define an abstract asset task used with a {BABYLON.AssetsManager} class to load assets into a scene

Hierarchy

Index

Constructors

constructor

  • Creates a new {BABYLON.AssetsManager}

    Parameters

    • name: string

      defines the name of the task

    Returns AbstractAssetTask

Properties

errorObject

errorObject: object

Gets the current error object (if task is in error)

Type declaration

  • Optional exception?: any
  • Optional message?: string

isCompleted

isCompleted: boolean

Get if the task is completed

name

name: string

Task name

onError

onError: function

Callback called when the task is not successful

Type declaration

    • (task: any, message?: string, exception?: any): void
    • Parameters

      • task: any
      • Optional message: string
      • Optional exception: any

      Returns void

onSuccess

onSuccess: function

Callback called when the task is successful

Type declaration

    • (task: any): void
    • Parameters

      • task: any

      Returns void

taskState

taskState: AssetTaskState

Gets the current state of the task

Methods

reset

  • reset(): void
  • Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again. This can be used with failed tasks that have the reason for failure fixed.

    Returns void

run

  • run(scene: Scene, onSuccess: function, onError: function): void
  • Execute the current task

    Parameters

    • scene: Scene

      defines the scene where you want your assets to be loaded

    • onSuccess: function

      is a callback called when the task is successfully executed

        • (): void
        • Returns void

    • onError: function

      is a callback called if an error occurs

        • (message?: string, exception?: any): void
        • Parameters

          • Optional message: string
          • Optional exception: any

          Returns void

    Returns void

runTask

  • runTask(scene: Scene, onSuccess: function, onError: function): void
  • Execute the current task

    Parameters

    • scene: Scene

      defines the scene where you want your assets to be loaded

    • onSuccess: function

      is a callback called when the task is successfully executed

        • (): void
        • Returns void

    • onError: function

      is a callback called if an error occurs

        • (message?: string, exception?: any): void
        • Parameters

          • Optional message: string
          • Optional exception: any

          Returns void

    Returns void

Generated using TypeDoc