RealDocs

UAssetManager::LoadPrimaryAsset

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

Description

Single-asset convenience wrapper around LoadPrimaryAssets for loading just one primary asset and its bundles.

Caveats & Gotchas

  • Internally forwards to LoadPrimaryAssets with a one-element array, so the same indefinite-lifetime and possibly-null-handle behaviour applies.
  • Passing an invalid or unregistered FPrimaryAssetId does not report failure through the return value — the call still returns a handle and still invokes the delegate, so check the loaded object yourself if you need to confirm success.

Signature

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

Parameters

Name Type Description Default
AssetToLoad const FPrimaryAssetId& The single primary asset to load.
LoadBundles const TArray<FName>& Bundles to load for the 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

Loading a single primary asset C++
FPrimaryAssetId AssetId("Item", "HealthPotion");
UAssetManager::Get().LoadPrimaryAsset(
	AssetId,
	TArray<FName>(),
	FStreamableDelegate::CreateUObject(this, &AMyClass::OnItemLoaded));

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.