Hi, I’m working on a 2D game and have a couple of questions about the Inventory Menu:
I’d like the Inventory Menu to automatically close whenever an inventory item is used on a hotspot. I tried using the Events Editor’s Inventory - Interact event, but nothing happened. What’s the best way to handle this?
When a new item is added to the inventory, I’d like to show a visual effect on its slot—something simple like changing the background color. Is it possible to do this through an ActionList, or would I need a script? If so, which references would be helpful?
Any advice would be greatly appreciated. Thanks so much.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
The Inventory: Interact event is fired when using an Item by itself. When a Hotspot is involved, you can use the Hotspot: Interact event.
A script would be needed, and there's a few ways you can approach this - but you'd need to rely on Unity UI for the Menu's Source.
One way to do this is to attach an Animator to each Item slot's associated Button in the UI prefab, with e.g. a Trigger parameter that gets fired when the item in that slot is added.
Through script, you can then hook into the OnInventoryAdd event, get the associated Button, and from there affect the attached Animator:
Thank you so much for your help!
The Hotspot: Interact event works perfectly with the Inventory: Check selected ActionList!
And thank you again for the code. It not only solved my problem, but I learned so much from it too. I can already see how I might apply this approach to other features as well!
Your guidance is always such a huge help. I really appreciate it.