Centralized resolving of the FAssetData associated with each Actor

Hi Adam,

I’ll start by just clarifying a few concepts. Unreal doesn’t keep track of what asset created an actor, but it does indeed at the package level have a system that keep track of the dependencies of the package (file) as it is on disk. Search the engine code base for usage of the asset registry with those function GetReferencers and GetDependencies. To get the asset registry implementation you can simply use the static Get on the interface IAssetRegistry. Once you have your dependencies you can simply use the package to query the AR for the asset data(s) associated to these package. This is how the find reference tool work.

Note that only the levels/world that use OFPA (one file per actor) will have a package per actor. The non OFPA world will use only one package for whole the level. For those you could get the referenced objects by serializing the actor with a custom FArchive that capture the object reference that don’t have the actor in their outer chain.

Otherwise the GetAssetsToSyncToContentBrowser use some per actor type logic to determine what asset matter for a specific actor type. If you want the exact result but without being tied to user selection, I would just recommend duplicating the code here and remove the line where it grab the user selection and replace it by your own actor handles. You can get the handle for an actor by using the AcquireEditorObjectElementHandle function of UEngineElementsLibrary and create your own custom selection set.

For more context the editor use handles for the selection and a setup of interfaces to allow the selection in some tools to interact with some element that might not be UObject based. The implementation details there are still evolving at the moment and this is why the setup is not yet documented.

I hope this will help you,

Julien.