API/core/ResourceManager/

ResourceManager

ResourceManager

constructor 

new ResourceManager(engine: Engine)

Create a ResourceManager.

Parameters

  • engine

    Engine to which the current ResourceManager belongs

engine ReadOnly

engine: Engine

retryCount 

retryCount: number = 1

The number of retries after failing to load assets.

retryInterval 

retryInterval: number = 0

Retry delay time after failed to load assets, in milliseconds.

timeout 

timeout: number = 20000

The default timeout period for loading assets, in milliseconds.

cancelNotLoaded 

cancelNotLoaded(): void

Cancel all assets that have not finished loading.

cancelNotLoaded(url: string): void

Cancel assets whose url has not finished loading.

Parameters

  • url

    Resource url

cancelNotLoaded(urls: []): void

Cancel the incompletely loaded assets in urls.

Parameters

  • urls

    Resource urls

gc 

gc(): void

Garbage collection will release resource objects managed by reference counting.

remarksThe release principle is that it is not referenced by the components, including direct and indirect reference.

getAssetPath 

getAssetPath(instanceId: number): string

Get asset url from instanceId.

Parameters

  • instanceId

    Engine instance id

Returns

Asset url

load 

load<T extends >(path: string): AssetPromise

Load asset asynchronously through the path.

Parameters

  • path

    Path

Returns

Asset promise
load(pathes: []): AssetPromise

Load asset collection asynchronously through urls.

Parameters

  • pathes

Returns

Asset Promise
load<T extends >(assetItem: LoadItem): AssetPromise

Load the asset asynchronously by asset item information.

Parameters

  • assetItem

    AssetItem

Returns

AssetPromise
load(assetItems: LoadItem[]): AssetPromise

Load the asset collection asynchronously by loading the information collection.

Parameters

  • assetItems

    Asset collection

Returns

AssetPromise