Variable referencing Structure is gone and I can't compile

I created a structure to hold values before saving them, but when I tried to add more variables to the structure the Edtior crashed so I deleted the structure and created another one.
When I returned to the BP, the variable referencing the deleted structure was gone and i couldn’t create a new one with the same name. When I tried to compile it throwed the error:

Error The variable Savegame_Temp declared in MainMenu_Widget has an invalid type Structure.

Now I’m stuck. I could delete the widget BP but I’m on it for two weeks now.
Thanks for your time.

1 Like

You need to duplicate the Blueprint that is throwing the error. The editor will catch the invalid type and warn you that it will be removed. Now delete the old blueprint. A window will pop up and allow you the option to replace the old references with the new, error free version.

1 Like

This doesnt work. Im having the same issue but I tried your solution. The new duplicated blueprint simply gives the same error. It cannot compile because the variable is invalid, but the variable doesnt exist so I cannot delete it or fix it.

I an really hoping there is a fix, because I literall have about 50+ hours worth of blueprints in my project that are now trashed all because I changed a structure. Literally every blueprint that referenced that structure is trashed.

The editor didn’t warn you of an invalid type?

I had a similar problem mate. In your projects directory you should have the autosave directory. In there you’ll find various autosaves, which are kind of backups. if you know when that happened, take the autosave just before it happened. If you don’t know, you’ll have to do some trial and error. Copying and checking. Just make sure you make a backup of the project just in case.

On a side note, that should be the moment you realise you need backups :slight_smile:

This happened on one of my structures. And it happens when a structure1 variable is inside a structure2 (in my case, they’re arrays of structures), and if structure1 is changed, structure2 will disappear and throw that error.
Go to structure2 and delete the variable of structure1 and make it again, save and compile your blueprint with them and structure2 should be visible again.

Hope that’s clear

You. Are. A. Life. Saver.

Second that

Haven’t found a solution but wanted to point out that this is still an issue in 4.20 :confused:

Go into your content browser, right click the blueprint or widget, go to Asset Actions and click Reload. This will reload from file, which will require all underlying data and structure associations to be reinitialized, Unreal will see the broken references and remove the lost references, thereby fixing your blueprint.

5 Likes

This worked for me!!! Now I just need to fix my entire project :frowning:

Thank you! This worked for me!

Thank you, worked for me too.

In my case, i created a some blueprints in a project, and other blueprints in other projects. When i try to merge it with migrate. All my blueprints died, The greatest part of them was that, a Structure in Structure, that not compile because a lost reference to a structure. Open it, reselect or delete, and recompile the blueprints, works for me