Inventory System in Unity (Using Grub 3D game character)

The inventory system was created to enable game characters to pick up, equip/unequip, drop and store *(in containers, like chests) items, and objects that adhere to specific conditions.


Basically, items that are found in the world, are in a layer, that is being ray-hit-tested, when these items are hit, a quick info box pops up showing that item’s information, this item may then be picked up, and added to the characters inventory, a full Unity custom GUI was created to facilitate this, and will be demonstrated here, objects that are in the inventory, are then viewable by another camera, that only renders objects in another layer, to a texture, which allows the model to be rotated and inspected from all angles, inventory items are also categorized, and all of this is done by adding script components to skinned mesh objects, these objects are then , when equipped, retargeted in runtime, to the specified bones, the inventory system also allows callers to know if items are equipped or not by type, for eg. if a shield is equipped, or a sword, or pants, or a shirt, so when the character equips an object of the same type, it will be replaced, this also drives the animation controller, in this case, Grub has animations for Unarmed and Weapons, but when for eg. he is in combat mode, and in Unarmed state *(boxing with his hands), and equips a sword or a shield, the animation will transition to weapons idle, and there are many other custom states like this, which were easily built in to his animation controller, this is all done using Unity, scripting and Mecanim.


Here are demonstrations of the Inventory system, all demonstrations were done using a Logiteck Dual action, USB game controller, and configured using Unity’s Input Manager,


Leave a Reply