Child blueprint gets parameters reset when changing code in parent

Hi,
I am experiencing a very weird and annoying bug.
I have a parent blueprint with a lot of functionality (a spaceship). This parent has a child blueprint. Only one for now, but I plan to have dozens when I make many spaceship variants.
Now, if I change code in the parent blueprint, it might happen that I lose several parameters in the child blueprint, which switch to values which I guess are the presets of each respective component.

Now, I noticed that this bug has been there since the dawn of times:

I am using now version 4.26.2.
Is this bug solved in the next version?
Any plans to solve this bug once and for all?
Anyone else experience the same with recent UE4 versions?

Thank you!

I’ve got the same issue and I’m using 4.27.

This is quite annoying dangerous because you often don’t recognize it directly, especially when it happens to arrays or gash maps with much data.

I currently tend to use data tables to define these and load the data in the actors constructor, instead of defining it directly as default values.

Hi HAF-Blade,
thanks for the info.
I set up about one week ago the Source Control, just locally on my hard drive.
I have to say that I did not experience anymore the “memory loss” on the Blueprint.
I won’t say it’s fixed, because I cannot exclude it to happen again, but maybe, just maybe, Source Control helps in mitigating this issue.

I managed to fix it in my project.

I wasn’t able to find the solution anywhere online so hopefully this can help someone in the future who has this problem. So here is what I did:

For reference, my class hierarchy has 3 layers, each inheriting from the previous: Base (1) → Parent (2) → Child (3)
I had several BPs where this issue was happening. I found it was only happening in Children (or the 3rd layer), and that all of them inherited from the same Parent class. The variable that was being reset was inherited from the Base class, and I realised that the Parent class actually didn’t display the inherited variables from the Base despite having ticked the box “Show inherited variables”. I unticked and re-ticked “show inherited variables” and suddenly the inherited variables were being displayed in the parent. Going back to the child class, the variable was able to successfully compile without resetting to the defaults.

I’ve also had work changing then compiling the default variable of the parent class, then changing that variable back to whatever it was before.

To me, it seems like the variable is resetting because the variables were inheriting properly. I don’t know why this fixed it for me. I don’t know if it’ll fix for anyone else, but this worked for me so maybe it will for you too.

1 Like

This is the right way to fix this issue. But in my case I also had to click revert button near the variables that lost data from parent

I think I’m late.

If you have this structure
BP_Parent

  • BP_Son_1
  • BP_Child_n+1

and you modify some variable of the parent, be it name or whatever, then all the children will lose the values of that variable.
To solve this:

1 - You create a Struct (FSetVariablesFromStruct) with the parameters you need.

In the BP_Parent
2 - You create a variable called type VFSetVariablesFromStruct (which will set the necessary variables to the parent) where all the variables that need to be set will do so from the child, they will do so through VFSetVariablesFromStruct.

3 - You can run it in the Construct or in the BeginPlay (I recommend in the Construct so you can see the changes)

Remember that if you rename or compile with any changes the VFSetVariablesFromStruct variable from the parent, all data in the children will be deleted. So try not to touch VFSetVariablesFromStruct or you will delete all the values. Surely UE5 deletes the variable while maintaining some type of reference and then resets it.

Now you can modify all the other variables of the parent, the children will not be affected.