Download

dynamically generate components from single component

I have a blueprint with a scene root, and a SceneComponent “base”, as well as a variable “numCopies”. What I would like to do is duplicate the entire “base” tree as many times as numCopies, each time with a different relative transform. Is this possible?

For example, I might have a static mesh and a light under my base component, and numCopies might be 5. The end result should be 5 static meshes and 5 lights. Possible? I’m more than happy to use C++ if it’s required.

The easiest thing to do might be to make a blueprint that contains your static mesh and light, then another to handle spawning a bunch of those with different transforms. You can use Add ChildActorComponent in the Construction Script of your spawner blueprint and just loop through it NumCopies times. Make sense?

Thank you, that’s fantastic :slight_smile: I’ve implemented it in C++ and blueprints now :slight_smile: