In Unreal engine blueprints, I have created a nested map of structs to store data.
In fact, the last level just stores references to certain objects.
So it is like a tree.
As you can see in the image above, Add is not working when code reaches there for the first time.
During runtime the struct1 is constructed elsewhere, several key-value pairs exist. At a later stage, I wish to have a single new key-value pair in this last level of the nested-map-structure.
Using a debugger, I validated that the <Name, struct3> has a unique value. But Add is not working and not adding a new Key-Value pair here.
This is in Blueprints, I will translate this code later to C++.
But is it not possible to do the same in blueprints?
Is there some limitations to Blueprints in this regard?
I don’t have a solution but can confirm that it works the same for me. The lower level struct stays empty after I try to add anything to it. I also doing it in blueprints. It’s just sad.
Well, I’m basically getting the reference of a map, finding a deeper-level map by the key (successfully), and using an Add function to push a key-value pair to that deeper-level map. Is there a way to mess things up with copying and not referencing here that I’m not aware of?
Update: There is also a weird bug that happened twice - out of the blue my nested map failed to compile. It seems that there is no real issue because the fix is to just add another empty variable to the map and delete it right away.
I’m indeed using structs as values in the map, and if it’s flawed in some way, I can see why this isn’t working properly.
I found a workaround for my case though. I’m just using a simple map with integers as values and after finding one with a key using that integer to set a struct in another array.