Cannot Fix

Unexpected List and Dictionary literal behavior with remove and add item units

Ex-Crow 2 years ago updated 2 years ago 2

I use a lot of AoT List literals and AoT Dictionary literals in graphs to set up things like card decks, icon libraries, etc

The behavior I expected would be a Set Variable unit caching the AoT List or Dictionary and any further operations on it would only impact the cached variable of the literal. 

But units such as remove and add item impact the literals directly in the graph like this:

For lists, I can work around that with the "new List" unit that accepts an existing collection as an input:

But there's no "new Dictionary" unit that would receive an existing dictionary as an input. I'm working around it with merge dictionaries unit, which is probably not very efficient. Especially when I have around 10 dictionaries to set at runtime like this.

Bolt Version:
Unity Version:
2019.2.14, 2019.3.0f3
Scripting Backend:
.NET Version (API Compatibility Level):
.NET 4.x
Cannot Fix

Hi TowerCrow,

This is a limitation of Bolt 1's design that allowed reference types in literals.

The solution is to use the Create List unit instead of a List Literal.

See: https://support.ludiq.io/communities/5/topics/2267-data-added-using-add-list-item-to-a-list-literal-is-retained-on-exiting-play-mode

What about dictionaries though?