Cast to child actor component variable not working

Trying to make variables in a Child Actor Component visible and working in a parent BP:s details tab in the Editor. I have set them to Expose on spawn and I the parent BP let:s me access them so that I can set them as variables in the parent BP. But, when I change them in the details tab in the Editor, nothing happens. The default variable values in the Child Actor still seems to be in control.
In the image you can see how the script in the parent BP looks. I should say that this script is in the Construction Script of the parent BP, since I’m making a tool that should be interactive in the Editor.
Any ideas? :slight_smile:

So, hold on. There is a LB actor in whose Construction Script we add a Child Actor Component and we want to change their properties / variables - trying to wrap my mind around it.

Yeah, sorry, I felt my question was poorly formulated. :smiley:
I have a Child Blueprint that generates a randomly built house when dragged into a level. That Child BP has a number of variables, for example: Number Of Floors, House Rotation etc. This whole generation is triggered from the Construction Script in this BP, where I call a number of functions in the same BP where the variables are used (in these functions).
From a parent BP I then generate a whole block of these Child BP:s.
I want the user to be able to set the variables of the first BP, the child BP, in the details tab of the parent BP after having dragged into the level.
So, to achieve this, I add the child BP as a Child Actor Component in the Construction Script of the parent BP. From there I Cast to the Child BP (as seen in the screenshot) and SET the variables in the Child BP through that cast. I then have promoted the pin with variable in the SET nodes to variables in the parent BP and made them Instance Editable. This makes them visible and possible to set in the parent BP:s details tab. Everything is accepted by the Editor when Compiling, but when I change the variables in the parent BP:s detail tab, the spawned Child BP:s do not change accordingly.
I do get this Warning in the Output log:
“LogScript: Warning: Accessed None trying to read property StaticMesh
…and then references to the Child BP and file paths.”

Or it could actually be that setting the parent variables do work, but that the child variables override them right after while constructing. Because the child BP:s are reconstructed each time I chance a parent variable, but with the child default values for the variables.
So, if I could figure out a way make the child construct script only run the first time, then it might work… :slight_smile:

The CACs are limited in some scenarios, especially when placed in the LB. The Construction Script keeps re-instancing its child actor. I never managed to get to it to work the way I imagined it should:

Above, I’d like to fiddle with the Instance Editable text variable in the CacTest that was instantiated by the Enemy actor via CAC. It works fine when you Edit the Enemy Blueprint, but not in the World Outliner.

What will work is this:

You expose the variable on the actor owning the Child Actor Component and push the data into the component in the owning actor’s Construction Script.

You can disable Construction Script running onDrag in the Class Settings. Other than that, not sure :expressionless:

Thanks - I’ll try this! :slight_smile: