Custom Collections
While this library provides many of the common Unity types you will use, you may want to extend this library with your own custom collections specific to your application. Fortunately, this is rather easy and typically only involves creating a derived class from one of the base classes. You may also add any additional helper properties and methods as you need.
Sets
- Create a new class that derives from
RuntimeSet<T>, whereTshould be the type of set. - Ensure the new type is marked with the
CreateAssetMenuattribute, so you can create instances in the Editor. - Create any instances of the new variable in your
Assetsfolder. - Configure the
isReadOnly,allowDuplicates, andinitialItemsfields as needed. - Now you can use them throughout your application.
NOTE: While most people create ScriptableObject instances in the Editor, you can create them at runtime as well!
Watchers
- Create a new class that derives from
RuntimeSetWatcher<T, TSet>, whereTshould be the underlying type andTSetis the set type. - You can now use the watcher component in your scenes.