[Question] Best way to get a list of objects that works when game is packaged?


I want to get a list of objects, preferably with out loading them first. Previous posts on the subject, such as Iterate all Blueprints derived from a class, didn’t provide me with an answer.

EngineUtils::FindOrLoadAssetsByPath works, but it loads everything, since you cannot specify a filter.
Trying to avoid that, as there would be no need to load particular assets on a dedicated server etc.

FPackageName::FindPackagesInDirectory looks promising.
I could get a list first, then pick my way through it using magic.

This leads me to the ‘works when game is packaged’ part of the question.

In UE3, all our code to do with loading items as required worked fine, until we packaged the game.
Needless to say, I don’t want to get deep into using a method only to encounter the same issue.

So… what is the best way to get a list of objects that will play nice when the game is packaged?
Or does something already exist that I have I missed completely? :slight_smile:

I am yet to package a game, let alone test the above methods.
Input, suggestions or outright answers welcome!

Thank you.


Hi Christopher,

Once you have all package names, you could try using GetPackageLinker and then GetExportPathName and GetExportFullName on the returned linker to get the name of the exported object. Note that this will probably return more objects than you might want because a package usually contains some additional objects but you could filter that yourself easily. Also bear in mind that this will be quite slow and create linkers for all packages you load so you might want to do it only once on startup and add a GC call once in a while.

In UE4 packaged game is just cooked data stored in a pak file. Pak files are transparent to the user so no need to worry about them and cooked data no longer uses seek-free loading and it’s just almost the same package as in the editor stripped of all editor-only data.