FStreamableManager can be used to load assets asynchronously. This is helpful to avoid potential hitching caused by asset loading.
Steps
Get the Streamable Manager via some method, such as UAssetManager::Get().GetStreamableManager()
.
Once you have it, you can use RequestAsyncLoad
to asynchronously load assets. The loaded assets are held in memory by the streamable manager for the duration of the delegate execution. If you need them to be held in memory longer, you must store them somewhere else in the delegate.
The function returns a TSharedPtr<FStreamableHandle>
. This can be used to cancel the async load via Handle->CancelHandle()
. Canceling the load also prevents the delegate from firing.
With soft object pointers
- Convert soft pointer(s) to FSoftObjectPath via
SoftPtr.ToSoftObjectPath()
- Load via
StreamableManager.RequestAsyncLoad(ArrayOrSingleSoftPath, ResultDelegate)
With asset registry assets
- Convert FAssetData from Asset Registry into FSoftObjectPath via
Asset.GetSoftObjectPath()
- Load via
StreamableManager.RequestAsyncLoad(ArrayOrSingleSoftPath, ResultDelegate)