RealDocs

UAssetManager::GetAllReferencersForPackage

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

Description

Finds all packages that reference any of the given packages, recursing up the dependency graph to the given depth.

Caveats & Gotchas

  • Recursion depth is controlled by MaxDepth; passing a large value on a big project walks the full dependency graph and can be slow.
  • OutFoundAssets is a TSet so results are unordered — don't rely on iteration order for UI or reports.

Signature

static void GetAllReferencersForPackage(TSet<FAssetData>& OutFoundAssets, const TArray<FName>& InPackageNames, int32 MaxDepth)

Parameters

Name Type Description Default
OutFoundAssets TSet<FAssetData>& Filled with the asset data of every referencer found.
InPackageNames const TArray<FName>& Package names to find referencers of.
MaxDepth int32 How many levels of referencer-of-referencer to recurse through.

Return Type

void

Example

Find referencers up to depth 5 C++
TSet<FAssetData> Referencers;
TArray<FName> Packages;
Packages.Add(FName(TEXT("/Game/Characters/Hero")));
UAssetManager::GetAllReferencersForPackage(Referencers, Packages, 5);
for (const FAssetData& Asset : Referencers)
{
	UE_LOG(LogTemp, Log, TEXT("Referencer: %s"), *Asset.GetObjectPathString());
}

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.