[SURVEY] There's A Really Really Terrible Bug Where Child Blueprints Get Their Variables Reset

Editor cannot remember some properties (hotload problem ?) and I cann’t package project, Editor and i doesn’t know what the exact reason, but one of something unusual i have done is, I changed the project name manually in the whole solution, maybe you can try this when reproducing your problem

That’s a very usful information and I can confirm this!

I can confirm some version of the issue occurs for me in 4.18.3 and and 4.19. I have reported it through the bug submission form. But, I will also provide my MWE of the issue (4.19 windows) if anyone would like to use it as a jumping off point for solving this.

In my case, the setup requires the following three parts: there is an Actor blueprint (lets call it BP_Parent), an animation blueprint (lets call it ABP_Parent), and another Actor blueprint called BP_Child. To reproduce what I am seeing do the following:

  1. Setup BP_Parent’s component hierarchy the following children: a child actor component of type BP_Child and skeletal mesh that uses ABP_Parent.
  2. Setup ABP_Parent’s component hierarchy with a single component of type of BP_Parent.
  3. In BP_Parent’s event graph create nodes that retrieve and cast both the animation blueprint and the child actor component to their concrete types (ABP_Parent and BP_Child, respectively).
  4. Using the blueprint editor, set any custom data in the defaults of the BP_Child child actor component inside BP_Parent.
  5. Close the engine and reopen BP_Parent.
  6. Observe the data you just set for the child actor component in BP_Parent is gone.
  7. If you are using 4.19 observe that reassigning the child actor component child class type to BP_Child causes an engine crash.

I believe this situation is caused by the circular reference between BP_Parent and ABP_Parent. Simply going into ABP_Parent and removing the component BP_Parent and any casts to it in the ABP_Parent event graph seems to resolve the issue for me. Though, this workaround is not ideal and imposes some quite restrictive design choices on the developer.

Link to mwe attached.

Hello, I was working on a project freshly started on 4.19 – After 3 weeks of work, this morning, I ve updated a static mesh model. This broke the whole child actor hiearchy. I have a static mesh, embeded into an actor (let s call it FA) that has a HUGE BP logic. In begin play, defining the static mesh through an exposed static mesh variable. Then, a top (let s call it SA) actor that includes FA as a child actor. Changing the exposed value of the child actor was updating the mesh in SA. Since I have updated the original static mesh, I can t update FA s static mesh through SA. Even creating a completely new SA dosen t work, the child actor won t update. Tried deleting (in FA) the static mesh variable, tried deleting the static mesh itself nothing solves the problem. So I might just have to completely redo FA. Wich now became really complex because of all the intersections between FA and the whole project. This is seriously scary, I mean, seriously.

This issue still exists in 4.19.
Create a cube blueprint and a sphere blueprint.
Drag the cube blueprint on the sphere blueprint as a child actor component.
Change the cube’s override material to M_Bush in sphere blueprint.
Restore the cube’s override material.
Change the cube’s override material to M_Bush, it will not work.

It is called data inherit in programming.
Store a flag to indicate whether some child property should override parent property is not necessary, and make it a bit not clean.
Dictionary data struct is used to store the property’s name and value pair.
If the child object does not have a specific property in it’s dictionary, then it will inherit from the parent.
If the child object has a specific property in it’s dictionary, then it overrides the parent.

Yes, I am talking about how Unreal seems to handle data inheritance.

I don’t care if it is a flag or a diff between two dictionaries of serialized properties, both would work just fine and can disappear when packaging the game if the overhead bothers you.
The problem is that this information doesn’t seem to be serialized as of now, which can create silent bugs during production and iterations on those properties.

The “override” information on properties is just a visual feedback in the editor views (yellow arrow) and will not prevent the situation I described to happen (if a child previously overriden has its value becoming equal to its parent, the override information disappears).

Figure Ill bump this a second as it seems the issue still has not been fixed. Has anyone developed a work around?

IIRC there’s not a single issue and single workaround .

One of the issues has been fixed today.

I don’t know how helpful this is, but I figured out what was causing this in my game - repeatably. I haven’t figured out a workaround…but I have ‘fixed’ the actors where the iteminfo is being reset to the default of the parent actor.

I have a BP_MasterItem

I have children of BP_MasterItem -> BP_itemHealthPotion and BP_weaponHeroSword which are craftable, as well as other items which are not craftable

I ran into this problem as soon as I closed Unreal Engine after making BP_itemHealthPotion and BP_weaponHeroSword craftable - narrowing down where to look. The method I was using to create a recipe list was in my inventory actor (BP_Inventory) I have a variable array - CraftingRecipes - of type BP_MasterItem: I populated the default values of this array with BP_weaponHeroSword and BP_itemHealthPotion.

Those 2 BP actor’s iteminfo were reset back to default, as well as their ingredient components (which were stored in iteminfo as a an array of S_InventorySlots (which contains ItemClass of type BP_MasterItem and an Amount integer)

I found that if an item was added to the CraftingRecipes array with no ingredients populated in the iteminfo, it still would reset - so I don’t think that is important – but I found that even though the ingredient components were no longer referenced explicitly in the iteminfo of BP_weaponHeroSword and BP_itemHealthPotion, if you went to Reference Viewer, they were still being referenced (and therefore still reset) when closing and opening the game.

I found that just adding ingredient components was not causing anything to reset as well if that BP was not added to the CraftingRecipes variable array.

I made another ingredient component made from BP_MasterItem → BP_MasterResource → Child – this was still defaulted when the BP that was calling it as an ingredient was added to the CraftingRecipes variable array.

I’m not entirely sure what conclusions to draw from this, but I found the cause in Unreal Engine for me, and I explored it a bit. My solution is to find another workaround for populating a recipe list…

This is happening to my project (UE4 v.4.20) as well. Say for instance I have a parent blueprint with a structure assigned to it + multiple child blueprints, the child blueprints are wiped clean of any structure attributes any time I add or remove an attribute to the structure. This means I basically have to save all child blueprint structure attributes somewhere on a textpad and manually enter them in.

This gets difficult when a child blueprint has multiple attributes; especially items with name, value, weight, icon, etc.

I don’t know if version 4.20.2 fixes this as I’m in China atm and my download speed is terrible.

Unrelated, but UE4 consistently crashes for me if I undo (ctrl+z) while working in blueprints.

I haven’t encountered this bug in 4.20.3 so far, but I have only encountered it once in the versions before. If this bug still exists in the latest version, then I hope Epic will issue a fix asap.

Also, I try to never do ctrl+z, as the undo function seems to be completely broken in Unreal Engine. I rather try to undo things by hand.

I believe I’ve followed the same tutorial as zSwitchz https://.youtube.com/watch?v=81wnJaixBnQ&index=1&list=PLmKKTERcjTPKEPl0nk48Tpmj-iWmzqo_Q

If that makes any difference, but… yeah, about setting variables on EventPlay, I guess I’ll try that.

These days I sidestep this problem by using data tables, which should be doing anyway. Do it!

Thanks for this!! I’m at work now, but have been thinking about this problem the whole day :0

As far as I am concerned, this is the biggest and baddest bug in UE4 … and it has not been addressed properly by Epic despite being around right from the start.

The amount of time wasted on this one… phew…

It’s the first thing I reluctantly have to tell people about when they are ask about the stability of the engine - and then I refer them to other engines.

lol I stay away from ChildActor component since before the engine went free…

Just to bump. This bug is still exists in 4.21

It looks like it happens when I duplicate an actor with components, and the components resets the value to default after every restart, but after I recreated the file, and did not duplicate it started to work as intended.

Then what are you doing instead, may I ask? I really need to know so I don’t run into this problem soon.

This is a great idea and I will be doing that from now on. I was going to use datatables / a database anyway for my economy stuff, so going the full way seems not such a bad idea. Even though it’s some extra work.

I’m just learning unreal and this bug took me two hours to figure out what was going on… Kinda maddening.