Struct invalidating when adding array elements inside it

UH oh, now I find out that what Batch code can easily do in a breeze, nest arrays inside of arrays but it looks like to me Unreal Engine runs into nesting troubles trying to do the same, and then corrupts itself. It seems the blueprints have trouble with nesting things.

TL;DR Adding elements to an array within a struct within a struct corrupts the outer most struct and every blueprint that had used it.

When the struct is corrupted, this message is given:


So you go and delete all references to these variables in your blueprint. All calls, all functions with output/inputs, all “make structs,” etc., and even deleting all variables and local variables.

After all that, it still tells you there are variables with invalid types, even though none are showing up in your variables section under “My Blueprint” because you have already deleted them.

For some reason, not even “Remove unused variables” works, saying there are no variables to search for.

The only way around this is to either recreating all the corrupt blueprints (copying and pasting doesn’t work, as it is a reference error to the struct) or importing everything to a new project.

Steps to Reproduce:

I have reproduced this problem in a clean project, and the steps are as follows:

  1. Create a struct with an array in it. We’ll call this Struct1.
  2. Create a struct that has a Struct1 inside it. We’ll call this Struct2.
  3. Use Struct2 in any context. Parameters, variables, make nodes, etc.
  4. Go back to Struct1, expand the array, and add in more elements.

After doing all of the above, all references to Struct2 have corrupted.

EDIT: Also, God forbid you referenced these variables in your level blueprint, as now your whole level is corrupt.

Hello ,

Thank you for submitting a bug report. I have reproduced this issue and logged a report for it 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.

Awesome, thanks!

How are you currently dealing with this? I just got this issue and have no idea what to do, I’d probably have to spend hours just re-wiring everything…

Issue has been deleted?

The link is still open, there is an extra period in the URL, I have now removed it and it should link to the correct page

Ah I see, thanks!

Yup, spent hours.

I haven’t ran into this situation since then, as in, I’ve never had to create this system, but what I did do was just try to plan ahead more, and create a backup when I tried to change stuff around.

Hours wasted, indeed.

Sounds like It might be corrupting something.

I’m wondering if I’m missing something big here. This open issue seems to be literally development halting for any project that makes a moderate use of structs in Blueprint, yet UE-41411 and UE-40033 both list target fix estimates of 4.18, which seem like it’s a heck of a long way off (and I don’t even know if that estimate is just short-hand meaning, “we haven’t started looking into it yet”).

Is there some workaround that won’t result in corrupting 50+ source files of mine when I change or add one variable to a struct? Shouldn’t there be more attention put toward fixing this issue in the short term? I upgraded my project from 4.12 and had no idea that it was going to prevent me from achieving certain development goals.

I finally found a workaround to this problem.

  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…

This bug is some hot garbage it broke nearly my entire project and is definitely not fixed in 4.21 after doing a hot reload.

Just a note if anyone is stuck with the issue where you cant delete the hidden variables which prevent your scripts from running, right click on the asset in the content browser and go to ‘Asset Actions->Reload’ to get the prompt to remove the invalid variables.

This is still breaking things even in 5.3.2. Please actually look into this as I now have wasted months of work from 1 struct change.