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>
, whereT
should be the type of set. - Ensure the new type is marked with the
CreateAssetMenu
attribute, so you can create instances in the Editor. - Create any instances of the new variable in your
Assets
folder. - Configure the
isReadOnly
,allowDuplicates
, andinitialItems
fields 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>
, whereT
should be the underlying type andTSet
is the set type. - You can now use the watcher component in your scenes.