I’m having an issue with passing my inventory ‘class’ variable between widgets. ‘InventoryWidget’ is the title of the widget blueprint that places the grid panel on screen, and ‘InventoryWidgetIcon’ is for setting the appropriate items into the grid boxes. But every time I pick up the item and check the inventory, the grid boxes never show the item. In the ‘InventoryWidgetIcon’ blueprint I’m unsure how else I can update the ‘ItemType’ class variable so that it populates the grid box with the appropriate items.
- Is the Inventory array definitely populated with valid elements that contain an Icon?
- Why do you pass the item class and create a new object in the widget? You can simply pass the item reference that is in the Inventory array.
- Is the soft reference for the Icon that you get from Item Object already loaded? If not, you need to use Load Asset instead of Resolve.
1 Like
You need to be setting the text, brush and visibility in the updateInventoryWidgetIcon function.
You are only updating these elements in the preConstruct phase which happens once during the widget creation process.
Pretty much just move what you have in the preConstuct to the end of the update function.
What is set to the variable inventory icon? You do not promote the newly spawned widget to this variable yet you call update on it. Perhaps this is where the spit of logic is causing an empty ui element?
Try using break points (F9 on a node) and follow the logic.
1 Like