Dictionaries
When we talk about collection data, we need to mention Dictionaries. Dictionary is similar to a List. However, instead of accessing a certain element by index value, we use a string called Key.
The Dictionary that you will probably be using most often is called Hashtable
. Feel free to dive into the C# documentation after reading this chapter to discover all the bits of this powerful class.
Here are a few key properties of Hashtable
:
Hashtable
can be resized dynamically like List<T> andArrayList
Hashtable
can store multiple data types at the same type, likeArrayList
A public member
Hashtable
isn't visible in the Unity Inspector panel due to default inspector limitations
I want to make sure that you won't feel confused, so I will go straight to a simple example:

Adding elements into hashtable
must contain a string with the key. The key is necessary for retrieving a specific value. We have mentioned this before but I want to highlight the main difference between ArrayList
...