There are probably many ways to do this, but I’ll briefly explain what I’ve done:
- Created a blueprint structure “InventoryEntry”, containing a item name field (string) and item count (int)
- Created an InventoryItemButton widget. This is a simple widget: A button with a text block.
- Added an InventoryEntry variable to widget.
- Bound the text block’s text to a function “Get Text”, which basically concatenates the InventoryEntry’s name and count.
- Created an InventoryList widget, which is just designed to hold a bunch of InventoryItemButton widgets in a vertical box
- Created a function “AddButton”, which takes an InventoryEntry as a parameter. This creates an InventoryItemButton, and adds it as a child to the vertical box (note: the Vbox has to have “Is Varable” selected in the designer)
- Finally, I’ve added an array of InventoryEntries to the InventoryList widget as a test. Then, on widget construction, I simply run a foreach loop over them and call AddButton
See attached blueprints for more detail (sorry for linked images, the answerhub upload was malfunctioning)