UMG and Inventory Slot Highlight

Hello

I’ve created a inventory system which based on UMG. Simple box slots based on array border with background an text. Each of them has a number slot (int variable “slots ID”) and my problem is…

I want to create highlight/overlap to item slot which was clicked. So I bind function “on muse button down” and “on mouse button up” to the border… I simply set a bool var “is clicked” on mouse button down is true and on mouse button up is false. And I have a variable which set my inventory slots ID (int). In widget i create a event tick and add a branch (if “is clicked” = “slots ID”) and is true it highlight my current clicked slot and is false do nothing. Everythink wroks great but… when I click on slot and next the another slot the previous slot also is highlighted. I must duble click on previous to deselect… What I want is when I click on any of the slots the the rest isn’t highlighted. Please Help!

I personally worked not too much with UMG and don’t know a lot about it which is why I probably won’t be able to help you here.

However it’s usually rather hard to find your mistakes by pure text posts. It’s just wild guesses if you actually described the break point and how well you described it to try to help you.

Usually a few pictures of your code help to get help quite a bit faster :wink:

Cheers

Hello Erasio

As you said, this is a printscreens of my project.

I recently helped someone with a similar question, maybe this will help you get on the right track.

Highlighting for Inventory Slot

Hope it helps :slight_smile:

Unfortunately my itembox have a different structure therefore I can’t use your method. My itemslots are dynamic, spawning new slots every time when I pickup some item. What I must do is a find solution where only one itemslot can by active, no matter how many I will click them → only one int ID at the moment can be activate.

Thanks Justin for the interest!

Anyone can help me??

At the very least, you could create a function to de-select any items in the array of inventory slots before selecting another.

MainWidget

  • InventoryArray (holding the slots)
  • DeselectAll() (set clicked to false on all items in the above array)

What you need is to get a reference in your slot that is clicked to the parent of the slot (the MainWidget so to speak) so you can call the DeselectAll function.

As always there are a million ways to solve a problem, but I think this one is decently simple enough.