I followed this tutorial: https://www.youtube.com/watch?v=w6_fetj9PIw and the one after it, and it works fine, but now I'm in a situation where I want to be able to stack my items up. I saw there was a thread on the brackeys forums about this a few years(!!) ago, but the files aren't available and I saw people were having issues with it anyway. Can anyone think of a way to modify it and preferably allow for easy loading/saving as well down the road (though absolutely not necessary, I can go down that rabbit hole later), or alternatively point to a different tutorial that would do so? Thanks in advance!

Here's the link to the scripts, I only went up to video 6 so there might be some new stuff in there but it should at least help! https://github.com/Brackeys/RPG-Tutorial/tree/master/Finished%20Project/Assets/Scripts/Inventory

(note: I added a variable to the item script that keeps track of how many items of that type the player has, but the problem is that when I add a new item to the inventory it keeps adding it to a new slot and messing up the counter because I'm unsure where to check if the item already has a slot in the inventory and what to do about it.)

  • \$\begingroup\$ It's more of a request for someone to do the work for you, rather than a question to the problem you have encountered. Try to be more specific and mention what you have already tried. There are infinite possible quantities of how you could write your inventory. To help you with this each person would have to know this exact implementation of inventory. \$\endgroup\$ Sep 17, 2019 at 9:04

1 Answer 1


So you already have added a property for "quantity" on your objects. This is a good start. There are a lot of approaches to this but the most straightforward approach is to use an "InventoryManager" class.

So rather than directly adding items to your inventory, they would pass through the InventoryManager. This class simply scans your inventory contents to see if the item already exists, and adds to the stack. This idea can be handled as a standalone class, or implemented directly into the inventory logic.

A more advanced way of handling this would be to implement an event handler instead.

Ultimately it's an issue of adding some more loops / if statements to your code.

As for easy load / save functionality:

Brakcey's scriptable objects tutorial is where you should start.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .