Download

Spawning modified Actor using the variable from another actor

Hello! Oof, my first time here…
So, I’ve got a question for ya, community! As a beginner, I’m kinda struggling with some simple things:

I’m making the weapon generator, good progress so far! It has multiple blank ChildActors, which I fill using the WeaponConstructor.
aKupJ82gYo8.jpg

I’d like to store the created Weapon Actor with all Childs (attachments) inside and then spawn it whenever I need it to.

I do know how to spawn actor using a class, however I’d like to spawn it from the variable.
RHzncUYNoKg.jpg

Anyone know how to do so?

P.S. Getting the class from my desired actor variable doesn’t keep the childs in.
P.S.S. I don’t mind overhauling whole thing, rewriting it to Structs or something like that. If that thing i’m talking about won’t work - what would be your approach?

I would not use the ChildActor Component as it doesn’t work in online multiplayer and that is what I normally work with.

The Components of the weapon I would probably make from StaticMeshComponent.

If only a handful of predefined weapons would be needed then I would create Child Blueprint classes one for each of the presets and just spawn them by class.

If you need a lot of variation you could spawn the weapons using a Data Table.

You could also do something modular where you spawn a weapon and add components at run-time.