Where is the grid index stored?

robinhood751

New member
I'm trying to make a shelf that visually contains the items in the shelf's inventory. How do I get the grid index so I can change the shelf appearance depending on where the object is stored in the grid?
 
Interesting.
The Inventory does not have an index actually. It's just a collection of items where the order does not matter.
In the UI we use a list of index, stored on the UI component, that points to the item stacks within the inventory.

So when you move items in the Inventory UI Grid it does not change the position on the Item within the Inventory just within the UI.

So I'm guessing your Shelf is a 3D object where the items are stored in some sort of grid right?
You can create a custom component with a list of ItemStacks (or item infos) and use that to move the index of the items around.

Another solution that is slightly more complicated is to create a custom ItemCollection specific to your game. And there you can store the items however you want. You can set the type of ItemCollection you use in your inventory directly in the inspector.
 
Top