I created an item that is stackable, it works fine but i have a problem. I’m trying to, on the inventory, show how the amount i have for this item. When i open the inventory everything is fine, but then there’s 2 problems :
i) When i pick an stackable item, every inventory slot shows the amount i have for this item.
ii) If i pick a non-stackabe item first, it won’t show the amount of the stackable item in every inventory slot ,because apparently for some reason the for each loop index is never incremented.
PS: the inventory has been set just like the UMG Inventory tutorial from UE4.
This is how i’m setting things:
The inventory struct:
The Construct for the inventory slot:
How i’m setting to show the visibility:
As you can see, there’s a note on the visibility for each loop. it says: The path is never executed. then_1
this is what the then_1 looks like(i’m pretty sure it increments the index)

Also, the inventory slot is really simple:
is set like:
-Button:
—Overlay:
-----Image
-----Text
You’re doing quite a lot mistakes here. At first, the StackAmountVisibility function isn’t working like you want it to because you misunderstood what the return node does. When you call a return node, your function ends. Directly! But your problems is rather that you lack understanding of object-oriented software design. In your InventorySlot Blueprint, you’re changing the visibility of different InventorySlots. You really shouldn’t do that. You didn’t show the nodes that cause your first problem but I’m quite sure both of your problems are caused by this reason.
The whole purpose of the StackAmountVisibility is to determine the visibility of the one InventorySlot it is called on. Don’t worry about the other InventorySlots here, they call this function for their own visibility anyway. Quickest way to fix your problems would be to delete everything but the branch and the 2 return nodes in this function. Then create a boolean variable called “IsStackable” for your InventorySlot and plug that in your branch. And in your MyHud widget you create an event called sth like “UpdateInventory” you call every time your Inventory is changed. Within this event you set the new variable “IsStackable” of all of your InventorySlots depending on the “IsStackable” value of the respective InventoryStruct this InventorySlot represents.
It’s working like a charm.
I ctrl+c’d a lot the tutorial because i was busy at the time. I checked what everything did by myself after but i ignored the refreshInventory function. Gotta take more care about those things next time