Inventory System
Recently I was playing Subnautica: Below Zero and it inspired me to develop my own inventory system with the same mechanics.
Design and Mechanics
The inventory system is designed to be sorted in a custom way (e.g. alphabetically) and each slot is not stackable. The user can assign objects to a toolbar slot either from their backpack inventory or the toolbar. The user can also store their items to storage containers and retrieve them in the future. I used Scriptable Objects to create different types of items divided by categories such as resource, consumable, equipment and tool. Each category has its own features but inherit from the same Scriptable object.
The player can pick up items, smash objects to get resources (e.g. stone, tree trunk) and open any storage container using the left click. The backpack can be accessed using the Tab key. When the backpack is open the player can assign any item to their toolbar using the binding keys 1-5. On the other hand, when the backpack is closed, the player can equip any item in their toolbar using the mouse scroll wheel. In the demonstation video you can see that the player assigns the knife at the first slot in the toolbar and equips it. Doing so, the damage that the player can now do is increased, allowing them to smash the rock and tree trunk less times to get the resources. In addition, when the player equips an item, they can drop it by pressing right click. This is also allowed when the backpack is open and they hover over an item while clicking right click. In contrast, clicking the left click allows the user to use any consumable while the backpack is open (i.e. consume it) inceasing their health.
Animation and Assets
Since I didn't want the world to be bare and boring, I added some free 3D assets from the Unity Store to lighten the environment. On the other hand, I created the UI assets myself. In addition, I wanted to add animation to the character to indicate when they pick up or break an item, so I added some animation clips including an avatar from Mixamo. I also ended up creating the breaking animation myself in Unity because I couldn't find something I liked. This was my first time using only Unity to create an animation. I also used Animation Rigging so that when the player holds a weapon to follow the motion of the hand as well as the Animation Layering to blend the motion of the hands while the player is walking. I spent a lot of time tweaking the animation state machine so that the animation looks decent in the end result and I had a lot of fun doing so.
Project information
- Category: Game project
- Genre: Survival Game
- Project URL: Source Code
- Tools: Unity, C#, Photoshop