Inventory UI doesnt work

I just wonderd why this doesnt work. I tried to make my own inventory system but its not working. Only the latest object in the list is seen on the widget. But when i print the list it is all right. Please help me.


There’s a lot things wrong with this.

  • every time you press I you create a brand new widget, then discard it, then create a new one, and so on. Instead, create it only once, reference it and then show / hide as needed. Not only is this an order of magnitude more efficient, but will also allow the widget to retain data.
  • if you read the tooltip of Get Actor of Class you’ll note it tells you not to use it every frame - but the function binding the node is currently in does execute every frame. It’s a common trap - avoid it, especially with Get Actor of Class. See next point…
  • it is not the widget’s job to look up data, its job is to present it to the user. Consider adapting an Even Driven approach; populate an array → refresh widget. Rather than have the widget check 120 times per second whether some obscure changes were made.
  • the script does not work and shows only the last entry because you override the variable in the loop, and only the last element is assigned to the text variable. The IntentoryT is just a single piece of text. This ties to the previous point - you already have an array of Inventory strings - have the widget display that. Ideally, create a widget for each entry and add it to some container inside the inventory widget.

Thanks for the help!!!

I did it this way if anyone wonders:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.