How to duplicate a component from the blueprint?

Hello.
I would like to duplicate a component and its children from a blueprint.
Also, can I use blueprints for this? Do I need C++?

I want to use at runtime.

You can make a static mesh component with AddStaticMeshComponent, and you can also attach them. I’m sure it’s possible that way.

1 Like

Can I duplicate a component that already exists?
Do I have to duplicate each property after adding it with AddStaticMeshComponent?

If you have spent ages configuring a component, you can just CTRL+W it to duplicate it, of course.

Is it possible to do that dynamically at runtime?

Not in blueprint, as far as I know…

You can override a static mesh component (and most other components) and make a custom one:

image

This will give you a full graph, variables, functions and whatnot. You can then Add (those) Components from the dropdown or add them dynamically with Add Component by Class:

image


Other than that, you’d need to laboriously copy the required data. Were you to override a component as suggested above, you could get class defaults:

image

edit: the attachment can be created dynamically since Add Component by Class can be invoked inside another component. So you can have…

image

…a custom StaticMesh1 create a Child Static Mesh - the latter could be a native static mesh component. This way all you need to worry about is 1 component. How to set it all up really depends on what else is going on and, most importantly, the scope.

2 Likes

Using Add Component By Class inside a component causes a target error.

This component cannot own anything, get Owner and pipe it in as Target.

@Everynone @ClockworkOcean
It worked!!
Thank you for helping me!!

2 Likes