The downloader in loader's pipeline, it's by default the second pipe.
It's used to download files with several handlers: pure text, image, script, audio, font, uuid.
You can add your own download function with addDownloadHandlers
The loader in loader's pipeline, it's by default the third pipe.
It's used to parse downloaded content with several handlers: JSON, image, plist, fnt, uuid.
You can add your own download function with addLoadHandlers
The md5 pipe in loader's pipeline, it could be absent if the project isn't build with md5 option.
It's used to modify the url to the real downloadable url with md5 suffix.
The default progression callback during the loading process, if no progression callback is passed to {{load}} function, then this default callback will be used.
Add custom supported types handler or modify existing type handler for download process.
Handlers for corresponding type in a map
Add custom supported types handler or modify existing type handler for load process.
Handlers for corresponding type in a map
Get all resource dependencies of the requested asset in an array, including itself.
The owner parameter accept the following types: 1. The asset itself; 2. The resource url; 3. The asset's uuid.
The returned array stores the dependencies with their uuids, after retrieve dependencies,
you can release them, access dependent assets by passing the uuid to getRes, or other stuffs you want.
For release all dependencies of an asset, please refer to release
Here is some examples:
The owner asset or the resource url or the asset's uuid
the dependencies list
Returns an item in pipeline.
The id of the item
Only asset of type will be returned if this argument is supplied.
Get total resources count in loader.
Gets a new XMLHttpRequest instance.
Returns whether the asset is configured as auto released, despite how "Auto Release Assets" property is set on scene asset.
See: {{setAutoRelease}}, {{setAutoReleaseRecursively}}
asset object or the raw asset's url
Load resources with a progression callback and a complete callback.
Url list in an array
Callback invoked when progression change
Callback invoked when all resources loaded
Load assets from the "resources" folder inside the "assets" folder of your project.
Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
Url of the target resource. The url is relative to the "resources" folder, extensions must be omitted.
Only asset of type will be loaded if this argument is supplied.
Callback invoked when progression change.
Callback invoked when the resource loaded.
This method is like loadRes except that it accepts array of url.
Array of URLs of the target resource. The url is relative to the "resources" folder, extensions must be omitted.
Only asset of type will be loaded if this argument is supplied.
Callback invoked when progression change.
A callback which is called when all assets have been loaded, or an error occurs.
Load all assets in a folder inside the "assets/resources" folder of your project.
Note: All asset URLs in Creator use forward slashes, URLs using backslashes will not work.
Url of the target folder. The url is relative to the "resources" folder, extensions must be omitted.
Only asset of type will be loaded if this argument is supplied.
Callback invoked when progression change.
A callback which is called when all assets have been loaded, or an error occurs.
Release the content of an asset or an array of assets by uuid.
This method will not only remove the cache of the asset in loader, but also clean up its content.
For example, if you release a texture, the texture asset and its gl texture data will be freed up.
In complexe project, you can use this function with getDependsRecursively to free up memory in critical circumstances.
Notice, this method may cause the texture to be unusable, if there are still other nodes use the same texture, they may turn to black
and report gl errors.
Resource all assets. Refer to {{release}} for detailed informations.
Release the asset by its object. Refer to {{release}} for detailed informations.
The asset to be released
Release the asset loaded by {{loadRes}}. Refer to {{release}} for detailed informations.
The asset url, it should be related path without extension to the resources
folder.
If type is provided, the asset for correspond type will be returned
Removes an completed item in pipeline. It will only remove the cache in the pipeline or loader, its dependencies won't be released. cc.loader provided another method to completely cleanup the resource and its dependencies, please refer to {{Loader.release}}
The id of the item
succeed or not
Indicates whether to release the asset when loading a new scene.
By default, when loading a new scene, all assets in the previous scene will be released or preserved
according to whether the previous scene checked the "Auto Release Assets" option.
On the other hand, assets dynamically loaded by using loader.loadRes
or loader.loadResDir
will not be affected by that option, remain not released by default.
Use this API to change the default behavior on a single asset, to force preserve or release specified asset when scene switching.
See: {{setAutoReleaseRecursively}}, {{isAutoRelease}}
The asset or its url or its uuid
Whether to release automatically during scene switch
Indicates whether to release the asset and its referenced other assets when loading a new scene.
By default, when loading a new scene, all assets in the previous scene will be released or preserved
according to whether the previous scene checked the "Auto Release Assets" option.
On the other hand, assets dynamically loaded by using loader.loadRes
or loader.loadResDir
will not be affected by that option, remain not released by default.
Use this API to change the default behavior on the specified asset and its recursively referenced assets,
to force preserve or release specified asset when scene switching.
See: {{setAutoRelease}}, {{isAutoRelease}}
The asset or its url or its uuid
Whether to release automatically during scene switch
Generated using TypeDoc
Loader for resource loading process. The engine automatically initialize its singleton object {{loader}}.
since v3.0 loader is deprecated, please backup your project and upgrade to assetManager