Changing Structure breaks Blueprint and DataTable

Sorry in advance, I don’t really know how to describe this.

I created a new (blueprint-only) project (see attachment) and created the following things:

  • a structure StructPerson_Traits (String Name, Boolean Positive, Integer Level)
  • a structure StructPerson (String Name, StructPerson_TraitsArray CharacterTraits)
  • a DataTable based on StructPerson with 2 entries
  • a blueprint PrintPersons_BP which holds an array of DataTableRowHandles of the person it should print to screen+log upon BeginPlay

When I hit play, everything works like a charm. But when changing the structure StructPerson_Traits, things go out of whack, the links in the blueprint get broken (all references to StructPerson_Traits are replaced with some temporary …REINST… structure, existing nodes like the one getting the array index can’t be re-connected due to type mismatch) and the entries in the DataTable are more or less wiped (but only after a restart!).

Here’s how you reproduce it with the clean, functioning project I supplied:

  1. Open the project, open the StartMap level and hit Play to see what it looks like when everything’s working: It should correctly print the 2 persons with their personality traits). Also note the entries in the DataTable DT_Persons are correct.
  2. Open StructPerson_Trait and just change the default value of the Level member variable to something else
  3. Save the structure.
  4. All other assets are marked dirty now. Hit SaveAll.
  5. Open the DataTable again. The values are still correct (this will change after you restart the engine).
  6. Close the project and re-open it. Load the StartMap level. This is where things will get fun.
  7. Check the Output Log. There should be quite a few yellow and red lines.
  8. Check the DataTable (certain field should be empty now)
  9. Open the actor blueprint and note the wires are cut (although it was only the default value we changed). Re-wiring shouldn’t work because the types don’t match (as you can see in the tooltip when hovering over the pins): the structure coming from the ForEachLoop is the “new” type (called …REINST…whatever…)
  10. You should see a compiler error (among others) saying the struct isn’t compiled. To correct this: Open the structure, click the New Variable button, delete the variable you just created and save it. Might need another restart of the engine so you can actually use this structure in the blueprint again (without having to re-do everything)

Expected behavior:
Changing the struct’s default values shouldn’t break the connections (or at least keep a temporary, non-functioning grayed-out wire so you don’t have to search the entire blueprint to see where the connections have been cut), nor should the DataTable based on the struct have some (or all) fields set to empty (what’s odd here is: it is still keeping the array structure, so Hugo should still have 2 empty traits) after restarting the engine

Attached Project

2 Likes

+1 Same here, in 4.14. Changing struct breaks all blueprints that use it, if the struct is used as struct array in another struct. I’ve found a workaround to fix it, but it still disconnects the nodes :frowning: In your struct that has struct array, change the variable to non-array type, then change it back to array type. It should bring back the normal reference instead of these ‘REINST STRUCT’ ones.

Plan. your. structures. before. the. actual. implementation. end of story, mate :slight_smile:

Hi nischtz,

Thank you for letting us know about the trouble you have been having with this. I was able to reproduce the results that you described, and I have entered UE-40033 to have this investigated further.

any update on this? This issue seems to be deal breaker when comes to using datat table and struct for complex designs.

It’s still happening in UE 4.16.1. How come it is not fixed yet?

I’ve had same problem in UE 4.16.1. Your solution is perfect. Thanks dude!

A workaround is to go to all blueprints that contain the structure changed, and go to File>Refresh All Nodes. That seemed to work for me.

aren’t structs supposed to NOT be changed after implementation? maybe i’m wrong

Another possible workaround what we used in our project.

If you change struct, after change do not save Blueprints where struct was referenced, just save the struct, shutdown editor, restart editor :slight_smile:
At start engine will rebuild bps and pins will not breaked.

Not the best method i know, but working.

3 Likes

This bug still happens in 4.17.1.

It’s in 4.17.2 as well.

I finally found a workaround to this problem. AmphDev’s workaround didn’t work for me, but it was the right idea and sent me down this path.

  1. Open project in UE4.
  2. Go to your project’s content folder in explorer, and recursively make everything read only. (I did this on Content\FirstPersonBP\Blueprints for my project)
  3. In explorer, locate the child struct and parent struct(s) that you want to change, and uncheck read only.
  4. Change the child struct as you please, and save it. Then save the parent struct(s).
  5. Close the UE4 editor (don’t let it save the files it thinks has changed, it won’t be able to anyway).
  6. Go back to explorer where you recursively made everything read only, and uncheck read only.
  7. Open your project back up.
  8. Rejoice, for your old code is still together and functional!

Fundamentally, it seems like changing a child struct destroys the parent struct for long enough that any assets using the parent struct have a bunch of references removed. So, if you make those assets read-only, the UE4 editor can’t stomp all over them.

What a frustrating bug. Hours upon hours wasted…

1 Like

This actually seems to work. Pretty unbelievable. Save just the struct, shut down the editor, ignore the save dialog for other blueprints that referenced it.

Not sure how reliable this is but so far, after a couple of tries, everything works fine.

1 Like

Thanks man this is saving me LOTs of time!!! I was almost looking for a razor blade:)

I accidentally “saved all” and then restarted the editor and all my structs are fine. I’m using engine 14.7.2 maybe the newer engine it works a bit better? Now I just save all and then close editor and restart it. It has been working all night and morning. :slight_smile:

,I ran into this problem as well. Since we are not all perfect planners I think this is an issue that needs to be fixed. Until then whenever I add something to a struct I just find all references of it and repair unwanted linking/exposed variables. It takes me about 30 minutes although my project is still in its infancy.

According to the tracker, it should be fixed in 4.19: Unreal Engine Issues and Bug Tracker (UE-40033) … Let’s hope that it’s really fixed this time :slight_smile:

Thank you–saved my day. UE 4.18.3.

and 4.21 ;/