UAssetManager::LoadPrimaryAssets
#include "Engine/AssetManager.h"
Access: public
Specifiers: virtual
Description
Starts an async load of the given primary assets and bundles, keeping them resident in memory until explicitly unloaded, and calls the delegate when loading completes.
Caveats & Gotchas
- • Loaded assets stay in memory indefinitely until you call UnloadPrimaryAssets — the returned handle going out of scope does not unload anything by itself.
- • Epic recommends the overload taking an FAssetManagerLoadParams struct for new code; this default-parameter overload is kept mainly for existing call sites.
- • If there is nothing to load (e.g. everything requested is already loaded with the requested bundles), the returned handle can be null while the delegate still fires.
Signature
virtual TSharedPtr<FStreamableHandle> LoadPrimaryAssets(
const TArray<FPrimaryAssetId>& AssetsToLoad,
const TArray<FName>& LoadBundles = TArray<FName>(),
FStreamableDelegate DelegateToCall = FStreamableDelegate(),
TAsyncLoadPriority Priority = FStreamableManager::DefaultAsyncLoadPriority,
UE::FSourceLocation Location = UE::FSourceLocation::Current()); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| AssetsToLoad | const TArray<FPrimaryAssetId>& | List of primary assets to load. | — |
| LoadBundles | const TArray<FName>& | Bundles to load for each asset in addition to their 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 list of primary assets with a bundle C++
TArray<FPrimaryAssetId> AssetsToLoad = { FPrimaryAssetId("Weapon", "Rifle") };
TSharedPtr<FStreamableHandle> Handle = UAssetManager::Get().LoadPrimaryAssets(
AssetsToLoad,
{ FName("UI") },
FStreamableDelegate::CreateUObject(this, &AMyClass::OnAssetsLoaded)); See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?