<aside> 🗒️ Part of Ari's Unreal Engine Notes.
</aside>
First, there’s a great usability friendly open-source plugin that might fit your needs:
HardReferenceFinder/Source/HardReferenceFinder/Private at master · heyomidk/HardReferenceFinder
In case that there are some references the plugin doesn’t find you’ll need to do some C++ debugging.
This is better explained in my more detailed post on the Epic Developer Community:
Failed to load [filename] Referenced by [function]
All dependencies are added in FPackageHarvester::TryHarvestImport
→ FPackageHarvester::HarvestImport
.
That function runs when you save your asset. To find the dependency you can either:
A: Make a conditional breakpoint: strstr(((FNameEntry&)GNameBlocksDebug[InObject->NamePrivate.DisplayIndex.Value >> FNameDebugVisualizer::OffsetBits][FNameDebugVisualizer::EntryStride * (InObject->NamePrivate.DisplayIndex.Value & FNameDebugVisualizer::OffsetMask)]).AnsiName, "TheAssetNameYoureLookingFor")
B: Write a conditional in either of that harvest functions:
if (InObject->GetFName().ToString().Contains(TEXT("BP_YourAsset")))
UE_DEBUG_BREAK();
Check the stack when that breakpoint hits for the path or name of the property that is referencing your asset. SerializeTaggedProperty
will have the property name for example.
You can put a breakpoint in UPackage::Save
, just before Pkg->Mark(OBJECTMARK_TagImp);
.
Or in FArchive& FArchiveSaveTagImports::operator<<( UObject*& Obj )
(or any of its other <<
operators).
By doing that you'll see exactly when a dependency gets baked into the asset, and can see the reason why from the callstack.