Structure blueprint doesn't show map values correctly

Blueprint editor seems to have a bug in regard to displaying the contents of a struct blueprint that is a map. To reproduce,

  1. create a struct blueprint MyMap (in editor content browser Add New → Blueprints → Structure)
  2. open MyMap in blueprint editor
  3. change member (MemberVar_0) type to string
  4. change from a single string to a map
  5. change value of map to some valid type, e.g., boolean
  6. save
  7. create another blueprint (MyMapTest) and create a variable of type MyMap
  8. Add logic to MyMapTest event graph to de-reference the map variable and print out the length and each key.
  9. compile and run. Will get length = 0
  10. now edit MyMap and add three unique entries, say, keys of “one”, “two”, “three”
  11. compile and run. Will get length = 3 and values “one”, “two”, and “three”
  12. now delete the “two” entry from MyMap
  13. compile and run. Will still get length = 3 and values “one”, “three”, and “two”
  14. change the name of the MyMap “three” key to “four”
  15. compile and run. Will get length = 4 and values “one”, “four”, “three”, and “two”

Even if you delete all values in MyMap, they will still be visible to MyMapTest.

Perhaps I’m doing something fundamentally wrong here, but it looks like a bug to me.

This is not a bug. This is a Feature!

Maps are sorted containers. This mean that map is kept sorted by the “key” value all the time. There is never a guarantee that he last element will be the last element you’ve inserted. In fact it is guaranteed that the last element will be the one with the highest “key” value. Have you noticed that the words “one”, “four”, “three” and “two” are in alphabetical order? This increases the search speed tremendously when you are working with large maps. (although it decreases the insertion speed)

I hope this clears out the things a bit :wink:

You’ve totally missed the point. The blueprint editor does not show all the values in the map and deleting values from the map does not truly remove them, although they disappear from the editor display. Renaming the key in the editor creates a whole new node instead of replacing the existing key/value pair.

Sorry about that. I guess I’m loosing focus. I’ll check it again later step by step.

No problem. An interesting extra tidbit is that the blueprint editor works properly for a map if it’s a variable within the test blueprint in regards to adding, deleting, and changing key values. It’s only when it’s in a blueprint structure component that it exhibits these problems.