RealDocs

UAssetManager::PredownloadPrimaryAssets

function Engine Since unknown
#include "Engine/AssetManager.h"
Access: public Specifiers: virtual

Description

Downloads the packages for a set of primary assets into the download cache using IoStoreOnDemand, without loading them into memory. The returned handle's FStreamableDownloadCachePin must be kept alive to hold the data in the cache.

Caveats & Gotchas

  • Marked EXPERIMENTAL — behavior and the FAssetManagerDownloadParams API may still change between engine versions.
  • Only downloads package data into the cache; it does not load the assets into memory, so a separate Load call is still required before using them.
  • LoadParams.DownloadParams is a TOptional and must be set, or the request has nothing to do.

Signature

virtual TSharedPtr<FStreamableHandle> PredownloadPrimaryAssets(
	const TArray<FPrimaryAssetId>& AssetsToLoad,
	const TArray<FName>& LoadBundles,
	bool bLoadRecursive,
	FAssetManagerLoadParams&& LoadParams,
	UE::FSourceLocation Location = UE::FSourceLocation::Current());

Parameters

Name Type Description Default
AssetsToLoad const TArray<FPrimaryAssetId>& Primary assets to download.
LoadBundles const TArray<FName>& Bundles to download for those assets.
bLoadRecursive bool If true, expands bundle references into sub-assets before downloading.
LoadParams FAssetManagerLoadParams&& Completion/cancel/update delegates plus download params; DownloadParams must be set.
Location UE::FSourceLocation Internal call-site tracking parameter, not for direct use. UE::FSourceLocation::Current()

Return Type

TSharedPtr<FStreamableHandle>

Example

Predownloading a map before loading it C++
FAssetManagerLoadParams DownloadParams;
DownloadParams.DownloadParams = FAssetManagerDownloadParams();
TSharedPtr<FStreamableHandle> DownloadHandle = UAssetManager::Get().PredownloadPrimaryAssets(
	{ FPrimaryAssetId("Map", "Level_02") },
	{ FName("Game") },
	/*bLoadRecursive=*/ true,
	MoveTemp(DownloadParams));

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.