Using Asset Manager in C++ to spawn Level Instances in a procedurally generated map

I am currently working on a Roguelike game and have run into a road block that is driving me crazy.

Simply put, I need to spawn in randomly selected rooms based on some inputs (size, style, point of interests, key features, etc…). To do this I have made some Packed Level Instance blueprints that act as prefabs for these rooms. These prefabs are to be stored somehow in a collection that I can access in C++ code and spawn instances of where needed with some initializing parameters.

After some research it seems overriding the Asset Manager and having some Data Asset Blueprints derived from a C++ Primary Data Asset class act as containers for these prefabs is the way to go. My problem is that I cannot for the life of me figure out how to even get started with this. I have looked at examples and watched videos on the subject, but I am struggling to get it working.

In the project settings I have set it up according to the documentation on Asset Management, and I have made a Primary Data Asset for my prefabs and tried deriving Data Assets from that, then used the ScanPathForPrimaryAssets function to search the directory for the Primary Data Asset, but it turns up nothing.

It feels like finding all Blueprint classes of a specified type in a directory and then spawning them in runtime should be fairly trivial, so I can’t help to think that I’m missing something obvious and it’s driving me crazy.

Does anyone have any pointers or good sources for this?
I am on engine version 5.1 if that matters.

Cheers!
SH

check this plugin out:

At least if you want to do it yourself, I’d suggest you take a look into the ProceduralLevelStreamingClass, there’s a function called LoadLevelInstance_Internal that literally streams a level into existence, the class is a derivate of the LevelStreaming engine class and should you want to, you could make your own based on some of his/her code and go from there

We’ve been using this plugin pretty successfully on our project and the developer of the plugin is pretty open for suggestions and usually answers questions

Thanks!
I will do it myself, as it’s a project for learning, but I’ll look at the function you mentioned! Thank you very much!

Cheers
SH