Do the basics

The Vault Dashboard window
Open Vault Dashboard by pressing (Ctrl+Shift+D) or clicking Tools > Cleverous > Vault Dashboard.
You can dock the window or leave it floating. The column on the left shows the categories and custom groups. The column in the center is the data/assets/content of the chosen category. In the center column the header has a cube with a green + symbol. This will create a new data entry of the current category you're in. The icon with the red x will delete the selected entry.
If you create a class that inherits from DataEntity then it will automatically appear in the hierarchy on the left column.
Valid types that appear are anything that inherits from DataEntity. These are going to be ScriptableObject classes and exists in the project as an asset file physically on the disk. When you create a new asset, Vault will put it in the /VaultCoreStorage/ folder. After creation of the asset the Dashboard will automatically focus to the new asset.
New assets are given filenames like "Data-{classname}-{timehash}". You never need to interact directly with the files, everything is accessible from the Dashboard. Assets are not loaded via the Resources API.
Now you have a new Item in your database that can be referenced with Vault API attribute [AssetDropdown(typeof(MyWhateverClass))]. This attribute will create a custom dropdown that shows every asset in the database of the selected type.
Inheritance is fully supported and the ideal path for architecture when using Vault. To make complex classes easier to read, you can use Unity's[Header] attribute to help distinguish when the next class properties are starting. For example in this image:
The headers [Item Properties] in the base class and [CONSUMABLE] in the derived class help organize complex classes.
Once you get things configured the way you want you can reference them in some Inspectors and get a nice clean dropdown of any item types anywhere using the AssetDropdown attribute.
[Header("Special item")]
[AssetDropdown(typeof(RootItem))]
public RootItem CoinItem;
The result of the AssetDropdown attribute when inspecting a GameObject that needs a reference to Vault Data.
This makes it very simple to access the items in your database from various places. You'll want to build components that take advantage of this easy approach.

To be clear you should be using the AssetDropdown attribute everywhere which will work fine at runtime because it's actually a direct reference to the object.
However, you can still reference by DB Key or Title. In this case you can access the Vault class and get the information you need.
int armorDbKey = armor.GetDbKey(); // Get the DB Key easily from any DataEntity.
DataEntity armor = Vault.Db.Get("Totally Sweet Armor"); // [Obsolete]
DataEntity armor = Vault.Get(dbKey); // Great for when you can't pass the reference.
Reference-based lookups on fields/variables will be fast O(1) operations!
Key-based lookups using the item's DB Key will be fast O(1) operations!
String-based lookups using the Item Title will be slow O(n) operations. Avoid!
In general, you want to design everything to be reference-based lookups with the AssetDropdown attribute. For serialization you want to serialize the DB Key (4 bytes) and look it up from the DB during deserialization. See DataEntity.GetDbKey().
You have absolutely no reason to ever use string-based lookups, or look for items by the Title, or manually type in a DB Key you want to lookup.
Copy link
On this page
How do I add database Items?
How do I access those items at runtime?