how to add child actor from array in construction script?
Hi, I was wondering how I could get different bp actors (lets say some differen types of door Blueprints and different types of Pickup bp's) inside my construction script. The only way I got it to work so far is via drag and drop from the asset library in my construction script, I wonder how I would get them in via the actions menu in blueprint, also I would like to have them put in an array to choose them randomly afterwards, like I do it with "add static mesh" too. At the moment I am randomizing what child actor to choose with lots of branches and random bools in it, and via drag and drop catched child actors.... that feels uber wrong! :P
Any hints or links would be very appreciated!
asked Apr 04 '15 at 11:07 PM in Blueprint Scripting
The array has to be "Exposed on spawn" and then you can asign the blueprint in the array slot from the editor in the details panel. note: The array has to be public( checkbox "editable").
Your array should be of type "class" and when chosing the random element select the class from the array and feed it into the spawn actor node.
answered Apr 04 '15 at 11:21 PM
In case anyone is still checking this thread, it definitely CAN be done. In my construction script I have an array of classes (Main Equipment C) which I want to become child actors. I add them using the a "ForLoop" and "Add Child Actor Component" node and then add the output of that node to an array of child actors (Main Equipment A), and immediately after "Set Child Actor Class" from my Array of classes.
Then in my event graph, when I need to trigger something on one of my child actors, I get it from my Main Equipment A array of child actors, and then "Get Child Actor" in order to get the reference I need to do it.
Hopefully this helps someone.
answered Sep 14 '17 at 04:01 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here