# Move All Items after one of the Items was used

**URL:** <https://forums.unrealengine.com/t/move-all-items-after-one-of-the-items-was-used/495744>\
**Category:** Blueprint\
**Tags:** inventory, unreal-engine, Widget, UE4, UE4-27, question\
**Created:** [February 8, 2022, 2:56pm UTC](https://forums.unrealengine.com/t/move-all-items-after-one-of-the-items-was-used/495744 "2022-02-08T14:56:23Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![eromanga](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eromanga](https://forums.unrealengine.com/u/eromanga)\
**Post date:** [February 9, 2022, 4:07pm UTC](https://forums.unrealengine.com/t/move-all-items-after-one-of-the-items-was-used/495744/5 "2022-02-09T16:07:34Z")

</div>

I can’t thank you enough!!! Really! Here is what I could do with all your help!!

I’ve used second method since it is easier 😅 !

I had a problem where after Items were deleted and put to last slot, when I picked up the same Item again it was appearing in random place because references were taken from ‘Inventory slots’ array And I couldn’t use wrap box array, I tried to get around using additional integers but after some time came up with this final result!! This works fine for me in vert aspect!!! I don’t know if it’s optimal (don’t think so actually) but deleting unused slots appeal to me and I think it’s the best choice! Here is how it all looks now

I start with 0 slots and add them on demand checking if there are any available slots

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/4/1f4c0d8bcd27e6259ea13d1e11c6b3c370adb871.png)

After Item is depleted I call a dispatcher (didn’t even know about it) I didn’t know how to make a reference from slot to inventory since adding inventory variable to slot widget didn’t work and tried making a bridge through main character but seems that dispatchers are better 🙂

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/2/e/32e9c873ed6afb141bfcd142eb1f9ea5ccf9a5a1.png)

So after dispatcher is called I remove slot from array and also from parent ( I don’t know if removing from parent removes it from widget fully, If it does not I’d like to know how but couldn’t find much)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/8/df87a9094752075a4f2028a3f75a95f1e69fc015.png)

That’s all! Works perfectly. Thank you so much, I learned a lot!! Could you please tell me if this code and logic is usable and not perfomance heavy?

Thanks !!!

---

_[View the full topic](https://forums.unrealengine.com/t/move-all-items-after-one-of-the-items-was-used/495744)._
