Nested structures in Blueprints- compile error when adding variable in base structure

I have a Blueprint Structure (StructBase) which is just a collection of bool, floats and vectors. I have another structure that uses StructBase, call it StructA. Finally, I have another structure, StructB that includes StructA and other variables.

If I add a new variable to StructBase (say a vector, it doesn’t matter what type), I then get an error in StructB and StructA and any BluePrint that uses StructB can’t compile. In the view for StructBase it says everything is ok. But in StructA or StructB, it gives me a ‘minus sign’ and says it needs to compile. There is no way to compile a structure.

What am I missing? I see there were problems w/ nested structures in blueprints back in 4.19, but I’m at 5.1.1 (on a Mac, but same thing happens on windows).

Is it a blueprint class or a blueprint struct?
I don’t think structs in bp can use inheritance so is it a bp actor that is taking the role of a struct? (hence the parent class StructBase)

thanks.

It’s a blueprint structure (right click in content browser, blueprint>blueprint structure). the original nested structure works fine. I only have a problem if I try to add another variable to the base blueprint structure.

in my experience blueprnit structs are just screwy like that. For that reason I usually define them in c++ these days, even if i only use them in blueprint.

restart the project is pretty much only thing i can suggest, but occassionally i’ve had blueprint structs corrupt an entire blueprint. Definitely make plenty of commits if you are using them.

1 Like

ok, so once I add a variable to StructBase, I then have to follow up the chain for each structure that uses it and change that variable to something else and then toggle it back to StructBase. then for every structure I did, I have to find all other structures that use that structure and toggle the variable. That is, I must do the recursive chain by hand for each structure.

that seems to be a bug, unless @3dRaven is correct and one can not nest structures (but why, it’s common in C++ and any other language that has structures).

I agree @BIGTIMEMASTER, blueprint structs are screwy. at least there is a (painful) workaround.

Seems that if you change the variable name in the struct it recompiles and the exclamation mark goes away

It’s a workaround for now. All structs now have a green checkmark

@3dRaven changing a name is not a problem. adding a new variable to the base structure is. see my last comment- you have to manually toggle the variables to get it to understand to recompile correctly.

If you change the var name holding the base struct variable it will compile and work (inside the struct where it is nested).

1 Like

ok, I didn’t try to change the name of the variable, I simply changed the type and then changed it back. clearly something needs to change so that a recompile is correctly done.