Member-only story
Setting up an Inventory System with Scriptable Objects in Unity
Letting the player gather inventory throughout a game is commonplace these days, so let’s take a look at one way to set up an inventory system. I know this system could be more generic, but I think it communicates an idea on how to approach inventory in Unity with the help of Scriptable Objects. Let’s go!
I’m just prototyping here, so this Health Potion is represented by a blue cube primitive. The Collectable script has a reference to an Item, which is a Scriptable Object.
Here we have an Ammo pickup using the same Collectable script, only with a different Scriptable Object assigned to the Item slot.
Finally, this cube represents a Keycard pickup, which can be used to open a specific door.
