Copying/creating actor blueprints in game

Let’s say that I have an actor class blueprint “Animal” with the skeletal mesh, variables like species, fur/scales, number of legs, and size all assigned.

But in game, the player may want to add another animal to the game that I haven’t implemented.

Is there a way for me to:

  1. Copy a currently existing actor blueprint, say “Dog”
  2. Have the user change things about the “Dog” through UI widgets
  3. Then save and compile this new blueprint while the game is being played?

Does C++ allow you to compile/add classes while the program is running?

I found a similar topic, but this doesn’t seem to be exactly the same: Creating and editing Blueprint from C++

Thank you in advance.

Gentle bump.

Another bump?

Hello out there?

I’ll try asking knowledgeable members of the community.


Any chance y’all have some insight for me?

It look like you just need inheritance.

Make a bp class Animal, this will be your parent class that contain all the common variable and function.
Then with a ui widget and some text input box, the player would create it animal category, leg etc…
OnSubmit > get all these data > spawn Animal (with it new input data)

Hey @PrairieDog116

you could create an animal blueprint with the settings you mentioned exposed on spawn. Then you would create a DataTable with some animals to choose from. E.g. you choose dog, compare the name to the names of the DataTable, get the settings from the table, plug them into the SpawnActor node.

If you want to create a custom “class”, you would select a preset like dog, that would load those settings from the DataTable into your UI or into your current PlayerClass in the menu level and would only be displayed in the UI from your PlayerClass. After changing some of the settings and using a different name for this preset, you would create a SaveGame after “Apply” or “Save Preset” etc. with these settings in the same way they are stored in the DataTable. So the next time you want to spawn an animal from e.g. a drop down menu, fill the dropdown menu with the names from the DataTable AND add the entries from the SaveGame. This way you could add animals (in this case only for the local player) to the existing ones.


Thank you both for responding!

This is very similar to the workaround I had thought of. Are there any concerns scaling this? Let’s say I wanted to spawn ~ 15-20 chickens per second assigning the unique chicken settings to each one as it is spawned (Assuming they get deleted later).

Does assigning the variables have significant cost?

Hey @PrairieDog116

in this case the spawning itself would be decreasing the performance of your game. Depending on what you want to achieve you could move the standard animals from under the map to the point on the map where you want them and then adjust their settings as saved in the chosen preset the user wants to spawn.

You could have a look at Actor Pooling, MassAI, VertexAnimation and Large Crowds in Niagara for some ideas.

1 Like