Download

Help, Widget Buttons Acting Strange

I’ve got a widget HUD with a number of buttons which let the player interact with inventory slots. The button itself is invisible in the normal state, and has a circle around it in the hovering and pressed states. When a button is clicked, if an item is in the slot the inventory is closed and the item is used. The weirdness happens when you reopen the inventory, even if the button is not being hovered over when you re-open the inventory, the button is stuck on the hovering image and won’t refresh to the normal image until the player hovers over and off the button again.

When you close the inventory, are you clearing all references to the widget after removing it? If not, the widget will remain in memory & I’m guessing that’s the reason why the button still retains its earlier state in spite of the inventory being removed from the viewport.

So whenever the widget is being removed, I’d suggest resetting the variables and button states back to default.