Ammo widget that counts total amount of ammo in slot/Grid like Inventory

Are there Tutorials out there where you can pull a total amount of ammo from a specific ammo from grid or slot like inventory? For example, If I have 1 slot filled with 20 rounds of 9mm in one slot and another slot filled with 60 rounds from a different slot, I want the widget to be able to identify that there’s 80 rounds in total if they have the designated BP weapon that uses 9mm.

I don’t know how you set up your system, but maybe you can use a Delegate when a Item Instance is added to your inventory and if is ammo update a total ammo value saved in your UI.

Are there Tutorials out there where you can pull a total amount of ammo from a specific ammo from grid or slot like inventory?

I hope not, that would a pretty badly designed system. The UI should not be counting bullets, its job is to display stuff. Have the inventory actor / component count what’s needed. Besides, since you’re already displaying numbers in the UI, you’ve already counted it all, surely… How else?


And if you really must do it this way, iterate over the slots checking what’s inside and add it up.