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" 13) 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.
asked Jul 11 '18 at 07:58 PM in Blueprint Scripting
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 ;)
answered Jul 11 '18 at 08:19 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here