Grid panel's "Remove Child" seems broken?

Hello, I’m implementing an inventory system. I have a widget blueprint WBP_Inventory, which has a grid panel. The grid panel holds and aligns a kind of widget blueprint WBP_Item. When an item is added, a corresponding WBP_Item is created and added to the grid panel with the following logic:

When a WBP_Item is clicked, it should be removed from the grid panel. I tried to use this logic:

266761-ue4editor-2019-01-28-08-45-00.png

But it resulted in a broken display of my items. I was able to poke holes in the grid panel with my mouse!

I had to clear all children of the grid panel, and re-add items according to my array of WBP_Items:

This gives a correct behavior, where if an item is removed, every item after it will be pushed forward one slot.

I wonder if I’m doing something wrong here? Does anyone have a similar experience?

Note: Screenshots only reveal part of my logic. I believe my array is properly maintained.

have you done a remove from parent?

I have the same issue and I’m using 4.22.

Remove from parent has the same strange effect.

something similar happens to me when I try to delete the widgets of a “uniform grid panel”, only half of them are deleted, maybe it is because I have two columns and there is some conflict, I have solved it by doing a reverse for each and deleting the children starting from the end.

1 Like

It’s better to use “Remove from index” from your array if you are removing from inventory, but remember> “Add index” later to keep the current slots. It’s a workaround that works 100% if you want to remove a specific item from your inventory. :slight_smile:

Going to leave this here if more people have the problem.

What you mean reverse?