[1.2.3] Create Dictionary Unit don`t work

Radomiej 4 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 6

Hi, my "Create Dictionary" unit don`t work in bellow example and I must use constructor for AotDictionary. That is a valid behavior?

When I use "CreateDictionary" directly, i always have 0 items in dictionary.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Not a Bug

Hi Radomiej!

The Create Dictionary unit does work like that; it returns an empty dictionary. You can then add items to it with the Add Item unit, which returns the dictionary with the added item.

I would advise against using the AotDictionary constructor directly.

Ok I know it, but when i use Create Dictionary, this don`t work like AotDictionary constructor. I have always 0 items dictionary(In my example I use 3x Add Items). In my example simple reconnecting "new AotDictionary" to "Create Dictionary" aren`t equals in logic behavior. 

1. When I use "new AotDictionary" after add 3 x Item, dictionary count = 3

2. When I use "Create Dictionary" after add 3 x Item, dictionary count = 0

This can be some kind of bug, I just mention this.

If I find some free time I will test it on empty project and update topic. 

I do example on empty project and still "Create Dictionary" give count == 0:

changed to "new AotDictionary" give count == 3:

Fixed in Beta

Thanks for the report! It will be fixed in v.1.3.

The actual problem was with the Add Item unit (same thing for Remove and Clear). Instead of returning the dictionary that was used in the input, it fetched the input again, so in this case, it was creating a new dictionary each time.