Sometimes when I open my game with UE, the same 2 variables (Maps) from the Gameinstance disappear, only to reappear once again when I compile the GI Blueprint, but losing every stored data inside of them (From the default value).
Once the variables reapper there is no longer any error on any other Blueprints that utilize those 2 variables that usually disappear, but because they are Maps I use as “databases” and lose all that data, it becomes annoying to have to put them back in every single time.
Is this a known bug or did I do something to those variables? And How do I fix it?
Because with maps you can easily find variables in an array without looping all of it, and because it is a great way to store data (like Enemy1 is an int for the key and EnemyInfo2 is a Struct for the value).
I was able to discover why this problem happened and “fix” it.
When you have two Structs (Let’s call them A and B), and Struct A has a variable of Struct B inside of it, and you try to add a new variable in Struct B (the one inside Struct A), after saving Struct B, UE won’t be able to recognize Struct A anymore.
It does know that the variable exists, but it just can’t find it, how to fix it?
Just go back into Struct A (the one that has Struct B that has been changed), and you can see an error where the Struct B variable was, after you find it just remove Struct B and add it again, if done correctly after compiling every other BP that utilizes that Struct A it should all work again just like before.
There is one problem tho, and that is that you will lose every stored default data, and, unfortunately, there is nothing that can be done to recover them, so before you fill your structs with data, make sure that you 100% they have all the variables you want them to have.