Inventory system how to add

Hello everyone!!!
i created an inventory same as c e in g develop examples list
I have to say it’s very well done…
however I can not understand how I can make the objects available … let me explain …
if I have 3 cherries… and I pick 2 more… how do I add them to the items I have available that I can then add to my inventory???

the example works on objects already present in the scene… but put into practice… how does it actually work??? I pick an apple and this apple?? How do I tell the inventory to add it to the number of apples???

Hi,
I’m not sure I understand the issue, as this is demonstrated and explained in the example:

thanks for your reply
I didn’t quite understand the example… now yes… just put the objects into play…
but now it gets complicated… because I have 2 containers…
one is the inventory of the example… the other is a top bar where I can choose items from the inventory and bring them into the game… a bit like when choosing a weapon…
what solution could i adopt???

I would suggest that you don’t bother with the top bar, simply deal with the inventory and duplicate the chosen items and quantity to the top bar. :thinking:

eh this is the problem I don’t have a way… how do I duplicate??? them at the end… if I put an empty slot when I pick up an object it will first occupy the one in the top bar or drag the sclot and the counter via touch… but I don’t know how I could do it…

By duplicate, I meant: if click is on apple + if cursor is on inventory + if there’s a free slot in the top bar: create apple in top bar, create text object QuantityCounter, link it to apple, and modify text to (inventory_count,apple).
Something like that…

no because it has only 2 objects the slot and the text that counts… for each duplicate it creates a different id

If the id is different, it’s not a duplicate…

exactly… and I need to bring an identical slot that I already have in my inventory to a bar of available items to use at the top

Dammn… soooooo hard :slight_smile:

1 Like