How to find a widget in an array of widgets created by a function?

sigh This is another one of those questions where I don’t really know how to ask.
So, I have a function which creates invSlot widgets and stores them in an array called ‘Slots’ in the order in which they were created (see a part of it here:)

. Now in my invSlot user widget class I define that on a button press, (the button is part of my invSlot widget, see here:)

a custom event is triggered. Now this customEvent triggers my dropItem functions which remove an item from a given Index in my itemList array, but for this to work I of course need to provide it with an index. This is where my question lies, I tried this: (all of this is done in the invSlot base widget, just so its clear to what the self ref is pointing towards)

to find the slot on which I am currently pressing a button in the array of all of my slots so that the returned index is the index I can provide my other functions with, but it always just returns -1 as an index so I suppose something is not working there. So, how can I find the slotWidget on which I am currently pressing the button in an array with all of my created slotWidgets?
(any help would be extreeemely appreciated, may also be an alternative solution, if the question is unclear please ask, I will remain active on this post)
Thanks in advance :slight_smile:

Dude, thanks so much <3 This actually solves my problem, didn’t think it was so simple but yet this solution works, I owe you :smiley:

Well, find self can not work. I’m not sure, just I think it should be done differently.

When you create buttons in “menu” from arrays (items for example), add for each button Integer variable 0…num (lets say BtnNumber) of button. Each button will have position of item in its array.

Than on button press check variable BtnNumber and you will know position in inventory and what to do next.

And I think, you not need struct if here only one position - item. Array is enough. If you need for example item and it’s position, weight etc - struct is perfect!

you have here tutorial for Skyrim like inventory, here buttons connected with inventory, I’m sure it can help you a lot. Not my page Complete Skyrim like inventory Tutorial | Shooter Tutorial

Enjoy :slight_smile: Comment is as answer now, you can select it to close question.

His inventory is not bad. I have similar solution and works well.