Dictionaries
Accessing values
Values are now accessed with a different method. Note, the v3.x method will work, but will be deprecated soon, as it is only left to handle auto migration of data.
In the above example, rather than calling dictionaries.Key("Flavor Text").ValueString()
we call dictionaries.Value<string>("Flavor Text")
.
We specify the type, and provide the Key
in the signature. There are still options for returning a random value or a specific index. As shown above, it will return the first value of the list, or the default value if the Key is not found.
You can also access the value via the KeyValue
object itself, but if the Key is not found, a null reference will occur.
flavorText.UpdateText(stat.dictionaries.Key("Flavor Text").Value<string>());
Migration to V4 Button
Objects which have Dictionaries will also have a "Migrate to v4" button. Pressing this will move existing Dictionaries data to the new structure.
The previous version had one entry for every data type, so you may need to remove the empty values for types that you are not actually using, by pressing the red "X" button.
Last updated