Download

Storing and Casting to Child Actor Array components

I’m trying to create a rotating automated assembly that is composed of child actors. I’m using an array to populate the child actor separate stations. I want to have them animate but each at a delay to each other using timers. The problem is I don’t know how to store the actual Class actors, (BP_Automated_Station#), into an array so I can selectively tell them to animate by casting and playing an event in the “BP_Automated_Station”. I can do a cast to all of type “BP_Automated_Station” and have them all play at once. When casting it does seem to always put them into an array in the correct order, numerically as they were created, but will this always be the case? If I have multiple instances of the Radial Array in my scene I’d rather have the array be created in the initial construction script and not have to do a separate cast and try to sort things later. You can see from my image I’m able to store the ChildActorComponents in an Array but how do I store the actual Class actor being place?
4d6afe63af32f8a450702e1e89b481cd318501c4.jpeg
Thanks,

Here’s an example of something similar I am trying to create.

They will be in the order they are added. And yes you can avoid the cast later by casting when you store the variable instead and change your variable array from child actor to whatever class you are casting.

Hey Ryan thanks for the quick reply, I’m still a little unclear as how to get the data coming out of the “Add Child Actor Component” to be the the actual Class actors, (BP_Automated_Station#) and store those in the array. I changed the variable array type to BP_Automated_Station Reference is that correct? I put some Cast To blocks on the screen if they are needed it may be easier for you to direct me which, if any, to use.
Sorry I’m an artist and I’m still pretty new to all this.
Thanks,
e704028f4d2e332ec10eeac88aa4f14fd7a748a2.jpeg

If you mouse over the Return Value of Add Child Actor Component you will see that it’s giving you a reference to the child actor component. From that reference, you need to Get Child Actor and cast from that (with cast to BP_Automated_Station).

Thanks Ryan for the initial explanation and Ross for explaining it more for me, its doing what I’d like now. : )
Here’s the working blueprint snippet for anyone else.

2a7c25400b1a5588d14a1b2fb98ad521a5853c15.jpeg