Parent blueprint doesn't get variable value from child

Hi, I have a parent blueprint with a variable of type Object (which is instance editable):


And a child of said blueprint which I place in the world, and then I select another object in the world for the value of said variable:

but the code in the parent blueprint doesn’t get the value of the variable (it remains NONE).
Anyone know why? Thanks.

You are applying the value to the child, not the parent. This is how it is supposed to work regardless the programming language.

1 Like

Thanks. But I deleted the child actor from the scene, then added it again, and now it works, for some reason. :person_shrugging:
When I debug, I see the code in the parent running. So I thought it’s basically being run on the child itself, because if you put multiple children in the scene, the code runs that many times. And so I thought the variable values will the ones belonging to the child that’s running the code at that time.
Am I wrong?

A child class is an extendable copy of the parent. Similar to a duplicate, but the code isn’t exposed. If you wrote in C++ you’d simple be “including” the parent.

Each instance is a separate execution of the class code.

1 Like

So am I to expect it might not work in the future? Is this a bad way of achieving what I want? Should I just copy the code straight into the children to ensure the variable value gets assigned?

Child class is the way to go. I’m just sure what you mean by the parent class getting updated.

Variables created in a parent will get updated in the child instance that’s being used. The parent itself will not see changes made to the child.