Construction script communicate with child actor componant

Hi All, I have a blueprint that is creating a spline road from the spline tut on the ue4 launcher in which I have changed to have street lights which are added in a function in the construction script using the add child component which works fine. the street light bp allows me to turn the lights on and off in its construction script how can i pass the the var true or false from my track generator to the street light?

Want i want to do is pass the light switch true /flase from track gen construction script to the added child components construction script is this possible and how would i achieve this pls any help as always appreciated

Cheers Dav

Usually setting a variable to “Editable” and then “Expose on spawn” (two check boxes in the details of the variable) it will add a pin when you create this actor. However I’m not sure if this works with “Add child”. It should in theory but I never tried it.

I hope this helps

Cheers

thx for your reply but iv tried cast to and creating a var light bp and allowing editable and expose iv even had a go at an interface which i may have done wrong but im not gettin anything… hmmm is it possible for construction script to communicate with another bps construction script?

Unfortunately it doesn’t, AddComponent nodes are really weird, it’s not possible to add any input nodes to them.

Did you find a solution for this? Im stuck on exactly the same. I have an actor, which has child actors of a different actor. The latter has its own construction script and variables for its construction are set during the construction script of the former actor. When I run the construction script of the former actor, the child actors construction scripts gets not run when I set any of its parameters… :confused: When I compile the blueprint for the child actors, their construction scripts get run, but as soon as I change the parent actor, every change vanishes :confused:

Never mind, I solved it :slight_smile:

You can get the actor from the return value from add child actor component and cast it to your Actor Class.
From this point onwards you can use every public variable provided by this class

Could you please expand on how you solved it?

Hey thedavross
Just a tip:
Instead of using a branch node in the construction script above. you could just use:
SetVisibility with your “Light Switch” Variable as an Input to “New Visibility” :wink:

Good Luck :slight_smile:

1 Like

Yes of course! I wrote a small static library function, which takes an actor and calls “RerunConstructionScripts” on it. When I need to run the construction script of a child actor after I have passed/set its arguments, I simply create it as above, change its public variables and then run that static library function on it. I can post a complete answer later, if you wish

Here is how I switched a child actor during construction, it may be what you’re looking for and it works