Before creating any inventory objects it is recommended that you first have a plan for how to organize the inventory. The first thing that you’ll want to think about is the Item Categories. The Item Categories are the most important inventory object as it structures your item database, it decides the attributes for all of the items, and it is also used to separate that actions that can be performed on each item.

Once the categories are specified, the next step is to create the Item Definitions. Item Definitions can be thought of as templates for your items. The Item Definition will have attributes that are common across all of it’s item instances. Each item instance may have a different attribute value for the same Item Definition. As an example you may have a “Big Sword” Item Definition but this sword has different attack values for each item instance.

Adding Objects

When a database is created it is given an Uncategorized Item Category and Crafting Category. These cannot be removed. Item Definitions require an Item Category to function properly and will be given an Uncategorized category when they are created in the editor. Similarly a Crafting Recipe will be assigned to the Uncategorized Crafting Category. 


New inventory objects can be added by opening their respective editor and by entering the name within the field next to the “Add” button. The search bar and sorting options allow objects to quickly be found within the editor. Selecting the object from the list will allow you to edit it within the editor.

When an object is created in the editor it is saved as a ScriptableObject and a reference to that object is stored in the Database. Most objects that are related (i.e Item Definition and its Item Category) will keep a reference of each other.

Removing Objects

Removing objects can cause confusion as some objects are dependent on others. To make sure things are clear we specify here exactly what happens when one of the objects is deleted.

Removing Item Categories

When an Item Category is removed the connection to the children is broken. If the category has any parents these will be connected to the children. When the category is deleted the children will keep all the attributes that were “required” by the deleted category

All the Item Definitions that had a direct link to the deleted category are either given a category that was a child of the deleted category, or a parent. If neither exists it will be assigned to the Uncategorized category.

If the category is removed at runtime all Item Definitions and Items of that category are unregistered.

Remove Item Definitions

When an Item Definition is removed the connection to the children of the Item Definition being removed is broken. If the Item Definition has a parent then the child Item Definitions will be parented to their former grand parent Item Definition.

If the Item Definition is removed at runtime all of the Items belonging to that Item Definition are unregistered. 

Removing Items

When an Item is removed no extra cleanup is required. The Item Categories and Item Definitions do not depend on the Item.

If a MonoBehavior is dependent on the Item an event function is triggered by the Item Object component just before the item is removed so extra cleanup logic can execute.