# Inventory UI doesnt work

**URL:** <https://forums.unrealengine.com/t/inventory-ui-doesnt-work/1907533>\
**Category:** UI\
**Tags:** inventory, unreal-engine, Array, UI, Widget, question, Blueprint\
**Created:** [June 18, 2024, 10:14am UTC](https://forums.unrealengine.com/t/inventory-ui-doesnt-work/1907533 "2024-06-18T10:14:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fullmane1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fullmane1](https://forums.unrealengine.com/u/Fullmane1)\
**Post date:** [June 18, 2024, 10:14am UTC](https://forums.unrealengine.com/t/inventory-ui-doesnt-work/1907533/1 "2024-06-18T10:14:59Z")

</div>

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.

 ![Skärmbild 2024-06-18 121017](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/b/56b48dd52610e9bba2a1712dcbefd13350027208.png)  
 ![Skärmbild 2024-06-18 121420](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/6/9d63dce5b1a949206238fb0455a524f6ed7d6bd8.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [June 18, 2024, 11:18am UTC](https://forums.unrealengine.com/t/inventory-ui-doesnt-work/1907533/2 "2024-06-18T11:18:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Fullmane1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fullmane1](https://forums.unrealengine.com/u/Fullmane1)\
**Post date:** [June 18, 2024, 12:08pm UTC](https://forums.unrealengine.com/t/inventory-ui-doesnt-work/1907533/3 "2024-06-18T12:08:40Z")

</div>

Thanks for the help!!!

---

<div class="post-metadata">

**Author:** ![Fullmane1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fullmane1](https://forums.unrealengine.com/u/Fullmane1)\
**Post date:** [June 18, 2024, 12:25pm UTC](https://forums.unrealengine.com/t/inventory-ui-doesnt-work/1907533/4 "2024-06-18T12:25:45Z")

</div>

I did it this way if anyone wonders:

 ![Skärmbild 2024-06-18 142512](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/a/0ea06a4680e3508fe626e80dc4aba74670b219d3.png)

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 18, 2024, 12:26pm UTC](https://forums.unrealengine.com/t/inventory-ui-doesnt-work/1907533/5 "2024-07-18T12:26:25Z")

</div>

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