RealDocs

UAssetManager::ChangeBundleStateForPrimaryAssets

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

Description

Adds and removes bundle state on a set of already-loaded primary assets, streaming in newly required bundle assets and calling the delegate once the change completes.

Caveats & Gotchas

  • • Only affects assets that are already loaded — it does not load AssetsToChange themselves if they aren't resident, use LoadPrimaryAssets first.
  • • RemoveBundles only removes the bundles you explicitly list; set bRemoveAllBundles to true if you want to clear every bundle not present in AddBundles.

Signature

virtual TSharedPtr<FStreamableHandle> ChangeBundleStateForPrimaryAssets(
	const TArray<FPrimaryAssetId>& AssetsToChange,
	const TArray<FName>& AddBundles,
	const TArray<FName>& RemoveBundles,
	bool bRemoveAllBundles = false,
	FStreamableDelegate DelegateToCall = FStreamableDelegate(),
	TAsyncLoadPriority Priority = FStreamableManager::DefaultAsyncLoadPriority,
	UE::FSourceLocation Location = UE::FSourceLocation::Current());

Parameters

Name Type Description Default
AssetsToChange const TArray<FPrimaryAssetId>& List of primary assets to change bundle state for. —
AddBundles const TArray<FName>& Bundles to add. —
RemoveBundles const TArray<FName>& Explicit list of bundles to remove. —
bRemoveAllBundles bool If true, removes all existing bundles even if not in RemoveBundles. false
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

Adding a bundle to already-loaded assets C++
UAssetManager::Get().ChangeBundleStateForPrimaryAssets(
	AssetsToChange,
	{ FName("HighRes") },
	TArray<FName>(),
	false,
	FStreamableDelegate::CreateUObject(this, &AMyClass::OnBundleChanged));

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.