RealDocs

UAssetManager::LoadPrimaryAssetsWithType

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

Description

Loads every primary asset registered under a given type and bundle set, useful for bulk-loading a whole asset category such as during cooking or level warm-up.

Caveats & Gotchas

  • Loads every asset currently registered under that type, which can pull in an uncontrolled amount of memory if the type contains many assets — prefer LoadPrimaryAssets with an explicit list for user-facing content.
  • Only picks up assets that have already been scanned into the directory; assets registered dynamically afterward are not included in this call.

Signature

virtual TSharedPtr<FStreamableHandle> LoadPrimaryAssetsWithType(
	FPrimaryAssetType PrimaryAssetType,
	const TArray<FName>& LoadBundles = TArray<FName>(),
	FStreamableDelegate DelegateToCall = FStreamableDelegate(),
	TAsyncLoadPriority Priority = FStreamableManager::DefaultAsyncLoadPriority,
	UE::FSourceLocation Location = UE::FSourceLocation::Current());

Parameters

Name Type Description Default
PrimaryAssetType FPrimaryAssetType The primary asset type whose registered assets should all be loaded.
LoadBundles const TArray<FName>& Bundles to load for each asset in addition to its default state. TArray<FName>()
DelegateToCall FStreamableDelegate Delegate invoked on completion. FStreamableDelegate()
Priority TAsyncLoadPriority Async loading priority for the request. FStreamableManager::DefaultAsyncLoadPriority
Location UE::FSourceLocation Call-site source location captured for streaming diagnostics; not meant to be passed explicitly. UE::FSourceLocation::Current()

Return Type

TSharedPtr<FStreamableHandle>

Example

Bulk-loading all assets of a type C++
UAssetManager::Get().LoadPrimaryAssetsWithType(
	FPrimaryAssetType("Map"),
	TArray<FName>(),
	FStreamableDelegate::CreateUObject(this, &AMyClass::OnMapsLoaded));

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.