Dictionaries Methods
v4.0
Getting Values
public T Value<T>(string key, bool random = false, int index = 0)
// Grab the "Flavor Text" of an item object
FlavorText.text = itemObject.dictionaries.Value<string>("Flavor Text");
// Choose a random portrait from a set of available Sprites
// In this example the "class" of a player is stored as an ItemAttribute
var playerPortrait = selectedClass.dictionaries.Value<Sprite>("Portraits", true);Safely Getting a Value
public T ValueSafe<T>(string key, bool random = false, int index = 0)Additional "Get" Methods
// Get a KeyValue object
var foundKeyValue = dictionaries.Key(key);
// Count the items
var numberOfKeyValues = dictionaries.Count(key);
var totalKeyValues = dictionaries.Count(); // No key provided, so counts all KeyValuesGet All Values
Adding Values
Add To Value
KeyValue MethodsLast updated