How to get sub-objects of an outer?

I programatically create data assets that contain sub-assets, meaning that I use NewObject on different data assets with the parent data asset that is shown in the content browser as their outer.
Since the assets would be ‘invisible’ to the content browser otherwise, I have an array in the parent data asset that keeps track of its children, which is also for user purposes.

Since it is bothersome and prone to error to keep a manual list of children assets, is there a way to simply request to get a list of sub-objects of a UObject?

On an asset you can call GetOuter(), but I haven’t seen something akin to GetInner().
The different functions of the asset registry so far haven’t helped me either.

The asset path to such a sub-object might be the following:

“/Game/Generated/Asset_1.Asset_1:SubAsset1”

Where the first Asset_1 is the package, the second Asset_1 is the actual asset contained in the package, and the SubAsset1 is the contained sub-asset.

As always, the answer reveals itself immediately after publicizing the question…

There is a function called ‘GetObjectsWithOuter’ in the UObjectHash.h.

It is not exposed to blueprints, but is an exported function, so it can be accessed in C++ directly. Using it in a wrapper UFunction seems to do the trick for blueprints.

1 Like