Repairing broken blueprint: "The variable ... has an invalid type Map of Integers to Structures"

I am migrating from 4.23 to 4.24 manually (since standard way ends in hangup… gratz). I created new 4.24 project and moved c++ code first (there is bunch of structures defined). Then I tried to migrate (by Migrate… option in popup menu when you right click directory in old project) other assets from old project to new project, including blueprints.

I discovered UE cannot into recognizing structures defined in c++ within blueprints (enums too). All kinds of breakage happens. That’s… disappointing.

I had to manually fix everything, then reload blueprint and confirm removing invalid variables. That worked until titular map of integers to structures (should be map of integers to AreaStruc). This one simply fails compilation with message:

"The variable AllAreas declared in BackroomGen_BP has an invalid type Map of Integers to Structures"

This variable is not visible in list on left, but it does exist. If I try to create new var with same name, it will refuse. I can search for it using Ctrl+F, but I cannot do anything with result. I don’t know how to remove it - only way I know (reload blueprint, warning will show with option to remove invalid variables) does not work.

So, is there any way to repair this blueprint? I really, really do not want to recreate it from scratch - it is pretty large with a lot of nodes, functions, variables etc.

1 Like

In case you still need a solution, or anyone looking for it, what worked for me was:

Right-click the BP asset on content browser Asset Actions -> Reload. Then Unreal will identify the corrupt variable and ask you if you want it removed (click yes)

20 Likes

@RCV2 the one post you made here has saved me from an hour long headache. Thank you.

In fact, my problem was saying “The variable ___ declared in ___ has an invalid type Array of Structures”. And it was fixed through this. Hopefully me including my problem’s text will help another person googling this obscure answer lol

2 Likes

This was really helpful for me also.

Thanks a lot.

It works for me too, at the beginning I thought it did not work but I had to compile the AnimBP then it was done. Thanks a lot

I had a variable that was invisible, but linking to a struct I wanted to delete and this solved it. Deleting the struct crashed unreal. I hope more people find this! Thanks!

This worked for one of my variables. But not one where the broken struct was the value in a Map(dictionary)

I had two variables fail to load after a botched redirectors-fixup.

  • Map<BrokenStruct, var> As Key, opening/reloading the blueprint prompts me to delete it which is a (terrible but workable) solution to my problem.
  • Map<var, BrokenStruct> As Value, opening/reloading the blueprint does not prompt me to delete it. There is the message about invalid type in the console log but no way to fix it.

A better solution would be if these variables showed up in the outliner still so we could change their type.

Man, you just saved me an entire night of staying up late! Thanks!

Wonderful thank you from the future!

Oh my God . You are my Hero.

I just had the same issue also with a TMap when I accidentally removed the struct used as the value…
Couldn’t find any reference to the TMap variable anymore after removing them all from the blueprint, but still had 2 errors when compiling about “Invalid type map of … to Structures”.

What I did was create a TMap variable in my parent C++ class with the exact name of the variable giving the errors (type doesn’t seem to matter). Then I was able to compile my blueprint again without errors.

What also works in newer versions, if you can’t find the variable to delete it and reloading the asset doesn’t prompt you to remove it:

  1. Add “UnrealEd” to your private dependencies, so you can include “Kismet2/BlueprintEditorUtils.h”

  2. Make a function that can use FBlueprinteditorUtils::RemoveMemberVariable, with the parameters being the blueprint, and the exact name of the variable as shown in the editor window, including spaces.

  3. Call this function in the editor, for example by using a BlueprintEditorUtility

Had to do this recently to clear out a variable that wasn’t showing up in the editor when I was many edits deep into a commit that I didn’t want to revert.