Structure Variables get corrupted

This can randomly happen on compile, the variable using the structure will vanish in the Variables list, in the graph it will show up as greyed out/ not found. The error will say the variable has an invalid type. The most annoying thing about it that all links in blueprint to any structure inside that structure will be deleted, like where Break, Make and Set Members is used. UE4 will find the variable again when the Structure asset gets changed and saved again but the links are obviously not reappearing.

I had this happen occasionally in 4.13 and I hoped it would be fixed in 4.15 but there it happened again after ca 10 minutes working with it.

I had this happen mostly with one specific structure asset, I then had it happen with another structure at some point after I added a structure array into that structure. (Recreating this to instantly have the bug occur did not work though) Since both structure assets with which it happens have a structure array inside the bug is likely connected to that. I’'m using both as a structure array with a structure array inside. The bug can happen without having changed anything in the structure asset, I could not find anything that triggers it other then that it happens sometime on compile.

Hello,

This is a known issue, which you can view here:

You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Update: This can even happen when you only change a default value inside a struct asset and that without having a struct inside that struct. It erased then all connections of that struct. Those variables were just plain variables, no arrays. It also erases all variable values of everything that is struct inside struct, no arrays required.
So in short structs are currently a buggy mess, any struct can get corrupted. I’m hoping this can get at least be fixed in 4.17, because they are hardly useful when they keep destroying themself.

1 Like

Update the bug/s can also crash the editor. I thought I had a workaround for the most frequent causes of corruption but it turns out it is also not fail save, here is my workaround:

When changed a structure asset, be it a change of a default value or a added/removed variable:

  • First make sure all blueprints will compile without errors

  • Save the structure that is changed then update all structure variables that have that structure inside by adding a variable and deleting that, then saving those.

  • Then compile all blueprints without saving, when it all goes fine without any values deleted in the blueprints save it all.

But in my recent structure variables change it crashed at the last point while opening a affected blueprint which then â– â– â– â– â– â–  up everything on restart.

When that happens the best bet is to get the autosaves of the affected blueprints but not by overwriting the corrupted blueprints since that does not work and instead putting the autosaves in the content folder then restating the engine and copying all the values from the autosave BPs to the actual used/referenced BPs by hand. If connections have been lost you can also overwrite the orginal BP with the autosave, that will get you back the connections but not the values. (arrays will be reset to empty, variables set to Zero, not default values)
If you want your stucture variables really save the only way seem to be to save the values inside save games, those values are even load able when the stuctures have changed since the save. It obviously comes with a bad workflow.

To be clear when you change a structure asset and then a affected blueprint compiles with a error everything gets â– â– â– â– â– â– . When you change a structure asset and not change/save also the structure assets that have that structure variable inside all those structure variables with the changed structure asset type inside will get â– â– â– â– â– â– .

It appears adding any new variables to one of my structure assets is now a ensured way to make the editor crash and corrupt the variables. When I have added a new variable and make everything as described, it seems to work all fine including compiling blueprints but as soon as I save a affected blueprint it crashes the editor and everything is messed up when restarting the editor.

I see you keep moving a fix for this back to a newer version, this is hands down the worst bug I encountered in UE4 and no one seems to really give a sh*t. I have also heard of other Structure related bugs in the forum and on Twitter, at some point someone has to fix these messy Structure variables, better sooner then later!

I agree, the state of of structs is atrocious. They have been very problematic two years ago already. I was just googling for how their current state is because I was expecting them to not be fixed. Seems like my expectations were correct and I’ll have to avoid structs.

Yea, well, If you can avoid structs, then I highly recommend that. I have so many settings in my game, doing that all with plain variables instead would be insane.

Now I also have the bug where UE4 resets variables inside Structs everytime I restart the Editor. It is just one particular bugging me for now. I could set this as a default in the Structure asset instead but when I do that I risk everything getting corrupted again…

The project I was talking about is a mobile sim game, trying to dive into Android development, moderate amount of variables.
I used Arrays, the first one storing the IDs, then other Arrays for their respective content. Access the content depending on ID. Then I group them into the same category to keep it clean.
In my case it works, for big projects I can’t imagine not having structs tho.

Has anything been fixed since??

Structures still suprise me with new crazy bugs:
Just added a single variable to a structure asset, that structure is used in a simple structure array which contains that single structure so it can be an array. It got messed up real hard:

216984-gifw433225232.gif

After resaving the structure array structure asset, I suddenly have this variable in the BP that I can not delete as seen in the screenshot:

216985-tzhrhfgh.jpg

It is now impossible to compile the blueprint, like it is completly broken without return.

Just saw staff marked its own answer as correct which links to answer hub. I read of an old target fix for 4.18. But it looks like it has been moved back and the new target fix is for 4.19… Unreal Engine Issues and Bug Tracker (UE-41411) and Unreal Engine Issues and Bug Tracker (UE-40033). If this is a different bug it’s worth making a new thread.

Yea, sadly they just keep moving the target fix to next version and they keep marking this answered. Seems all to be related, once it is corrupted all sorts of funky things happen. Here it turned out, I had to delete the LevelSpecifcBackgrounds variable several times which ultimately deleted the ERROR DUPLICATE variable, like there were then lots of variables with the same name. When I had them all deleted I was able to compile again.

I just keep posting new things about this here so that hopefully one day someone over there realizes fixing structure variables should be high up their priority list. As it can be seen in the original post, it is there since 4.13

Please fix the structure assets mess!
More structure assets wtf, I added some variables to a structure and then it crashed everytime I tried to compile a affected BP. NO structure in structure or structure arrays used! When it finally, after the 6th try compiled all my values were reseted to default. I then went to try to copy it over from a backup into the default settings so that I don’t have put up anymore with it reseting because everything is in the default values tweaked, turns out you can not even copy paste a structure into the defaults.

Also, I got this strange message when it finally compiled. I added that variable there.

1 Like

Can’t package my game and it seems all related to the structure variables and the references corruption! Made it a own post here: Can not Package because of Structures reference corruption - Editor Scripting - Unreal Engine Forums

This is still not fixed. Structures variables are randomly corrupted. Sometime after a clean restart of the editor (not a crash while saving/compiling something). This should be marked as a number one priority as it can break a project in one second.

Can confirm. All my structs had just broke themselves. Using UE4.18.3 as of 1/20/18.

Happening to me, found this page googling “structure no longer showing up as variable type.” This is the second time this week we’ve had a structure completely break our project file…

Just had my project broken by this bug too!
I tried to add one fresh variable to my c++ struct and that worked fine. Then making two more of the same type and then it all broke. :frowning: I have tried deleting Intermediates folder and regenerating VS files but nothing helps. Its broke.

If you have a problem with structs at 4.18, passing to 4.19 only makes things worst.

Do you mean when you try to open it with 4.19 or bugs while working in 4.19? I read some structure related fixes in the release notes. Hoping things finally get better.