This page describes how to add an inventory to your game.

The Inventory Engine

Starting in v4.0, the Corgi Engine comes with the Inventory Engine, More Mountains’ complete and autonomous inventory solution. It also comes packed with 2 demo scenes and ready to use items, so you don’t have to worry about plugging one into the other, it’s already setup for you to use.

Jekyll
The Inventory Engine in action in the FeaturesWeapons demo scene

The Inventory Engine is designed to be simple yet flexible, and if you want to use it, it’s recommended that you read its dedicated documentation.

Corgi Engine specifics

There are a few additions included in the Corgi Engine to make using the Inventory Engine even more seamless :

  • CharacterInventory : a new Ability, that will allow you to bind up to three inventories to your character. It’s mandatory for your character to interact with inventories and be able to swap weapons. You just need to type their names into the main, weapon and hotbar inventories, and the rest is taken care of. It will also let you define what weapon to auto equip on start, as well as what items to add to the inventory, should you wish to start with a specific ready and loaded inventory.
  • FeaturesInventory and FeaturesWeapons : two demo scenes focused on inventory features, such as picking items, equipping weapons, using stimpacks, etc. Great to get a quick glance of the possibilities offered by the combination of these two assets.

Setting up multiplayer inventories

  • fresh install of CE v9.0 on 2022.3.23f1, open FeaturesInventory
  • edit the RectangleWithInventory prefab, add a InventoryCharacterIdentifier to it
  • duplicate MainInventory, name it MainInventory, set its PlayerID to Player2
  • duplicate the UICamera’s InputManager, set its PlayerID to Player2
  • drag a RectangleWithInventory prefab into the scene at -70,-5,0, set its Character.PlayerID to Player2, set its CharacterInventory.PlayerID to Player2, Main Inventory Name to MainInventory, set its InventoryCharacterIdentifier’s PlayerID to Player2
  • press play in the editor, move right with Player2 (using arrows, N to jump) pick up the chicken, notice it goes into P2’s inventory. Move right with Player1 (WASD), pick up the teddy bear, notice it goes into Player1’s inventory. Note that for the sake of brevity, these steps don’t take into account weapon inventories, but the logic would be the same.