Download

A little help with inventories?

Hello people,
I was wondering if anyone can help me.
Attached is a screenshot of my inventory. I have it set up so that picking an item up will create a child button widget in the scroll box on the left. It shows the name, weight and value of the item too, so I have an array all set up.

I would like the name of the object to also appear on the text block on the right side of the inventory. However, I am tearing my hair out (not literally, but it’s close) trying to get this to work. I can make the text change to the first item I pick up, but that’s about it. I think it’s something to do with bindings and the onclicked event with the child button, but I’m not sure.
I have seen many tutorials, but they all cover earlier versions of UE and don’t seem to work anymore.

Please don’t be afraid to talk simply - I’m not very good at blueprints yet!
Thanks!

This kind of thing can be difficult to help with because there are so many ways to do inventory and the details may matter.
For example - when do you want the information to appear in the text block? when it’s picked up? On mouse over? some click event?

Broadly, I would pass a reference to the inventory to the slots as they are created. Then when the event happens that you want the text block data to change, the slot calls a function in the main inventory, telling it to update the text block.
The way the information is built I would probably handle in the item class, so that you can customize how/what information is displayed in each class rather than some giant algorithm in the inventory. So the slot would send a reference to the item with the function call, and the inventory can just access some “get item info” function in the item class to get a string to update the text block.

Maybe i’m not being clear enough or going too much into some details. Just ask if there’s something.

Ah, sorry, I wasn’t being clear enough - I want the text to change when the inventory slot is clicked on :slight_smile:
I think I get what you mean, I don’t have much time to try it just yet but as soon as I do, I’ll get right on it! Thanks so much for your reply and support :slight_smile: