RealDocs

UAssetManager::GetPrimaryAssetsWithBundleState

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

Description

Fills PrimaryAssetList with every primary asset that is loaded or being loaded and whose bundle state matches the required/excluded bundle filters.

Caveats & Gotchas

  • Only assets already tracked by the asset manager's load system are considered — an object that happens to be in memory for unrelated reasons will never appear here.
  • With bForceCurrent left false (the default), assets whose load is still pending are included based on their target bundle state, not their currently-completed state.

Signature

bool GetPrimaryAssetsWithBundleState(TArray<FPrimaryAssetId>& PrimaryAssetList, const TArray<FPrimaryAssetType>& ValidTypes, const TArray<FName>& RequiredBundles, const TArray<FName>& ExcludedBundles = TArray<FName>(), bool bForceCurrent = false) const;

Parameters

Name Type Description Default
PrimaryAssetList TArray<FPrimaryAssetId>& Out array that matching primary assets are appended to.
ValidTypes const TArray<FPrimaryAssetType>& Types to restrict the search to. An empty array allows all types.
RequiredBundles const TArray<FName>& Only include assets whose bundle state contains all of these. An empty array matches every loaded asset.
ExcludedBundles const TArray<FName>& Exclude assets whose bundle state contains any of these. TArray<FName>()
bForceCurrent bool If true, only consider the current bundle state. If false, also considers pending state. false

Return Type

bool

Example

Find all loaded items with a UI bundle active C++
UAssetManager& Manager = UAssetManager::Get();
TArray<FPrimaryAssetId> Results;
TArray<FPrimaryAssetType> Types = { FPrimaryAssetType(TEXT("Item")) };
TArray<FName> Required = { TEXT("UI") };
if (Manager.GetPrimaryAssetsWithBundleState(Results, Types, Required))
{
	UE_LOG(LogTemp, Log, TEXT("%d items have the UI bundle loaded"), Results.Num());
}

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.