#include <AssetCollectionAsyncLoader.h>
Inherits AZ::Data::AssetBus::MultiHandler.
|
using | OnAssetReadyCallback = AZStd::function< void(AZStd::string_view, bool, size_t)> |
| The user must provide this type of callback when calling LoadAssetsAsync(...)
|
|
|
static constexpr char | AssetCollectionAsyncLoaderName [] = "AssetCollectionAsyncLoader" |
|
Accepts a list of assets to load. Notifies (On Main Thread) with a callback once all assets have been loaded. REMARK 1: This class goes beyond simply calling GetAssetIdByPath, because it accepts a list of Asset Products that may not exist at all. For this reason it spawns a job that will call GetAssetIdByPath until it returns a valid Data::Asset<> for all requested asset products. There's a possibility one of the assets may never exist, and the job could run forever, it is up to the caller to cancel the job because it is taking too long. IN AN IDEAL scenario this class could query with AzToolsFramework API whenever the AssetProcessor is finished processing all assets and if one of the requested assets never became valid the job could auto finish with an error to the user, BUT we can not use the AzToolsFramework. REMARK 2: An asset can still be valid but may have errors. This case is handled properly and the user of this API will be notified whenever there are such errors.
◆ Cancel()
void AZ::AssetCollectionAsyncLoader::Cancel |
( |
| ) |
|
Cancel any pending asset loading jobs, etc. If no job is pending this function does nothing.
◆ LoadAssetsAsync()
Returns true if the list of assets were successfully enqueued for loading. Returns false if there were jobs pending or the input list was empty. @assetReadyCB Called on Main Thread. As each asset is loaded this callback is triggered. When "pendingAssetCount" reaches zero the user knows all assets have been loaded.
The documentation for this class was generated from the following file:
- Gems/Atom/Utils/Code/Include/Atom/Utils/AssetCollectionAsyncLoader.h