Shopping Widget

Well, you can draw the STORE widget (not the item) completely, in which case adding it to the viewport makes sense.

But it’s better not to delete EVERYTHING, but only clear the children in the vertical boxes in which the item widgets are located. It makes no sense to re-draw the ENTIRE STORE.

*StoreItems for testing it can be filled manually, but you need to make a separate function for filling the assortment.

You need to remember about optimization and not do anything that you don’t have to do. Creating widgets is not a cheap option.

This should be a store widget function, no need (even harmful) to do it in Game Instance.

Does this part need any fixing?

That is, does the Data Table need to connect to Owning Player? Row Name to Name?

After testing this new function, I got a couple of error messages.

Apparently, the Clear Children node doesn’t like the variable which I promoted from the Add Child to Vertical Box node. Likewise, when I promoted the Clear Children node to a variable, I couldn’t connect that variable to the Add Child to Vertical Box node.

No, you must create a variable (input pin) for the Data Table in the item widget and pass it to the item widget. Then in the item widget you get the item description, icon, etc. from the table.

P.S. In the element widget, instead of two pins for the table and row name, it is worth creating one ItemID variable and passing it, without first splitting it into the table and row name.

Let me guess - you created it that:

When you create a reference variable, you are essentially just allocating space for data. Initially, it does not point to any object, which is what the error says.

In addition, if you hover over a pin, the tooltip indicates its type - Panel Widget.


This is a parent class for many widgets, including Vertical Box. So you can specify Vertical Box for the Clear Children function.
But the Add Child To Vertical Box function needs a reference to Vertical Box. So you need a reference to Vertical Box, or a child class of Vertical Box.
The “magic” of class inheritance only works one way.

You don’t need to create another variable, you need to take a reference to the Vertical Box that you created in the store widget.
When you create a widget design - variables are automatically created and initialized for its elements.

If there is no variable, then set the “If Variable” flag on the Vertical Box details panel:


Result:

1 Like