Store Child Actor Variable inside Actor Component?

This one’s a real head scratcher. I am setting up a “Gun barrel” actor component that contains all the logic to shoot a projectile. It contains an Event I can call to shoot from it, which is easy to call from other blueprints.

Only issue is, I want an Actor Component to be able to call it. Since it will contain the shooting logic for my AI. Only problem is, is that some of my enemies have multiple Gun Barrels, and I want my Actor Component to contain a public array variable of my gun barrels that I can choose from the editor, as ordering them is important for choosing the order they fire in. But when I make a public array of “Gun Barrels” inside my Actor Component, the array variable doesn’t show up in the variables. And for some reason a Child Actor array wont allow me to select the Gun barrel Child Actor.

How can I make it so the Array of Gun barrel (Child Actors) can be present on my Actor component?

id recommend staying away from child actors altogether, you can just spawn it in and then attach it to a socket on your player.

i rarely use child actors components, but I believe child actor components are just arbitrary actors, so youll have to cast them to the gunbarrel blueprint to get any variables from it.

My colleague has said something similar! Only thing is, what can I substitute my Child Actors for? As Actor Components seem to lack the positioning/visual aspect that makes Child Actors incredibly useful. Is there another thing I can do to replicate this?

you can either spawn the gun actor in the construction script, store it in a variable, and attach it, but then you wont be able to move or edit anything about it in the blueprint, itll just be there. other alternative isto just keep using the actor component and cast to the gun class whenever you need variables from it

Awesome! If you could phrase that as the answer below, I’ll happily accept it so everyone will be able to see it :slight_smile: