This page describes how to create an inventory, how it works, and how to use it.

Inventories

Inventories, as you can imagine, are the core of the Inventory Engine. They’re the component that will store items and allow you to interact with them. They’re basically a list of items. They’ll handle save and load of that list, and give you methods to know whether or not they contain a certain object, or a certain type of object. Note that inventories are invisible, and displaying their contents is handled by a different component : InventoryDisplay. You can have as many inventories as you want in your scenes.

An inventory is defined by its size, that you can set via its inspector (Content > Size), or via the InventoryDisplay directly, a type, and a Target Transform (used to know where to spawn dropped objects, it’ll usually be your main character).

Inventories can have two types : main (regular inventories) and Equipment. Equipment inventories will have special methods to know what item is currently equipped. A typical use case is to have two inventories : a main inventory where you store items, and a Weapons inventory, where you’ll equip your current weapon. But you could have more. If you were to create a game like Diablo for example, you’d have a main inventory, a Helmet inventory, a MainWeapon inventory, a Shield inventory, a Bracers inventory, a Potions inventory, etc.

Creating an inventory

Creating an inventory is very simple. All you need is to create a new Empty Game Object in your scene, and add an Inventory component to it.

Jekyll
Creating an Inventory

The name you’ll give to your inventory object (Main Inventory in the screenshot above) is very important, as that’s how you’ll access your inventory, and you’ll need to reference that name in items, inventory displays, etc. You can then define its Content’s size and inventory type. Finally, you can set its Target Transform. If your character is already in the scene, you can drop it into that field. If you’re using the Corgi Engine, this binding will be done for you via the CharacterInventory ability, so you can leave it blank.