Smart toggle grid from item action button.

Robot_Nachos

New member
So I'm trying to create an inventory system where the player can click on an equipment slot to open an inventory grid with all of that slots items. I've made this grid and hooked its display panel's smart toggle up to an equipment slot with an on click event from the item view slot. And that works fine. However, when I try to do the same thing with an item action button that the grid opens, the smart toggle fails to close the panel. I've tried activating that grid's smart toggle manually from the inspector and that works fine. and I've tried hooking up the item action button's on click event to other components and that works fine too. Any guess as to what I'm missing?
 
Last edited:
So just to make sure I understand correctly. You've assigned the toggle on/off on the ItemActionButton inspector?

I don't think that will work. ItemActionButtons are spawned at runtime if I remember correctly (or at least they are pooled/reused). And then there on click event is set to call the item action assigned to that button. so any actions set in the inspector will be removed (If I remember correctly I could be mistaken)
Also what ItemAction are you using?

If you are using a custom ItemAction then you should definitely toggle the grid panel directly inside that custom item action.

If you do not know how to write code or do not want to make a custom item action, what you could do is use something other than the ItemActionPanel.
Simply have a panel with predefined buttons that always do the same thing.

I hope that points you in the right direction
 
I was using the move to collection item action, but yeah the inspector doesn't give any visual indication that a listener's event has been reassigned even at runtime. That's probably a unity thing though. In any case, I just ended up making a custom item action, works fine now.
 
Top