Scene Set up

9_ScriptableDictionaries

In this scene, there are 4 Elements spawners. Press play and start clicking on each of the buttons at the top: Spawn Air, Spawn Fire, Spawn Water, Spawn Earth.

As you can see, elements objects are being spawned and the UI updates with the count of each.

This is achieved using a ScriptableDictionaryElementInt : ScriptableDictionary<ScriptableEnumElement, int>.

Note: ScriptableList and ScriptableDictionary both inherit from ScriptableCollection. Therefore, they both share some common functonalities. You can basically use the Scriptable Dictionary as you would a regular dictionary (iteration, methods names , etc...).

Last updated