Is it possible to create a blueprint file from C++?

I wonder if it’s possible to add a new blueprint to my project using C++.

Try this:


If that is not what you are looking for, some description on what you want to do with that would be useful to understand the problem.

Sounds like a really interesting question. It shouldn’t be impossible but I’m pretty sure it wouldn’t be easy either. Why would you want to dynamically create a blueprint class? What for?

Hi, thx for the answer. I’m working on an UE4 tool to generate buildings from modules (then cities). I generate them by using a rule set. For example a rule set for haussmann buildings (which assets, how many floors, etc…). Each of my rule set is a blueprint class that can be selected by the user before the generation. He can choose/modify a rule set but i would also like him to be able to save one to use it later. That’s why I would like to create a C++ function that could create the blueprint “MyRuleset.uasset” in the project directory.

Hi, thx for the answer i will definitely check that.

Ok maybe what you need is a struct. It would be a much easier solution. The struct would represent your ruleset. You can include any number of variables of any type you want so you could technically add a variable for every rule you could possibly have and then check for the values that the struct contains to see if you create or not certain assets, for example the struct could have a float variable Windows and you could check if windows > 0 then build n windows if not then don’t.

I see your point in that you do need a data structure that can hold a specific ruleset but I don’t think that creating a different class for each one is the correct way to achieve this, instead you should create a class/struct/data structure that can hold any possible ruleset you want. That’s why I suggested the struct

But will it be easy to modify the variable (struct) values by the user of my tool (editor style) ? Thx for the help :slight_smile:

Modifying a value in a struct is a really trivial task you just use the Set Members in (YourStructName) node. Just remember to select this node and activate the pins for the members you want to modify on the options in the right panel.

The “difficult” part is deciding how to access the reference to your struct and who will hold this variables. For example, you could put it in your controller, or player class, or you could put it in the game instance or game mode. Or you could create an specific actor to handle this, something like a game manager actor. Whatever you do, it should follow your own heuristics

Thx for your help. I changed for struct, so much easier :slight_smile: