How to Clone/Duplicate actor with all it's components at runtime using blueprints?


I would like to know if it’s possible to clone an actor with all of its components at run time.

i looked at the current blueprints but i didn’t find anything related to this matter.

Also all of the previous forums don’t really include any way to do it in blueprints.

Any help is appreciated.

What exactly do you want to do (maybe it is not required to copy everything)?

A big part of my game is 3d archvis designer, my main bp is one main actor and users can add or remove mesh components to add them on the main actor.
The main actor is always the same but the variations of the decorations makes a variation of designs.
What i want is to have a library of all different designs that the user has made, therefore i want to be able to clone the main actor along with all of it’s components to be able to store it in the library as a separate actor.

My current solution is that i grab all of the components along with their rotation and mesh and location. this solution applies changes on my main actor, so i can change to different designs at runtime. But that means i cannot display all of the variations in 3d at the library together, because they’re all on the same actor and any change on one actor changes all the others.

I hope i explained well, if not i can tr to explain further.


When you right click select this Actor BP in your explorer view you can select Create Child BP. So you can then place the child version actor along as needed, even change them, without changing all the other child actors, since they are all based on the base/master actor.

Though it is unclear what exactly you mean with storing, but when using child bp’s you can change different child versions as you want.

I know about the use of child actors, but that wont work for me, because if a user made 3 different designs he should have 3 child actors, but if a user want 50 designs he/she should have 50 child actors.
this is all happening in runtime.

This is something i cannot define before hand, so that why i want to clone actors in runtime.

Lets say a user created a design they want, when they want to store it in their library of designs, i create a copy of the actor and store it in the library.

Is this a savegame node you want to use to store user data, or is this a web-based database you want to use to store data?

What I do to store user data, is to create a single string with special characters, store it in an array, and on load read the array containing all strings, then split the string according to the special characters I placed. The string information can be translated back into integer values. The easiest way however to save user data (the library) would be to create a savegame state, which would save user data locally.…ame/Blueprints

To create a copy of an actor use the Spawn Actor from Class node, pick the default actor, then update the actor with the user modified values. This would be done depending on how your actor is setup, ie. based on structure values, or on various variables. Basically when the user changes something you need to create a variable for it and store the modified value there, then copy this into the “placeholder/storage” actor on game load or at runtime.

Haha, I had just typed out a very similar response.

I tend to lean toward the first approach due to the fact that it allows users to share those strings. Great response :slight_smile:

Example for String reading values.

Notice that the GSData and SetString node are related to Gamesparks plugin, but without it it is very similar.

This could be really handy for my applications, also being able to share strings between users is super handy.

I will definitely do that.
Many thanks for the help.