How to remove multiple of the same widget from parent?

Hi, I’m making a load game menu with multiple slots, and on Construct the widget with the scroll box loops through an array with the ID of all existing save game slots, and then creates and adds as a child one “Slot” widget for each entry in the array.

This works, however it’s overwriting the reference to the “Slot” widget on each loop, so on Destruct it only removes the latest entry on the list.

How can I remove all of them? Is there a way to clear all children, or perhaps set unique references for every entry?

Yes, you can remove every child of a panel, it’s called ClearChildren (and you can call it on ScrollBoxLoadGame).

1 Like

This is the correct answer for your situation.

If you really wanted to store the references to the specific widgets you create, you could add each created reference to an array, and read each of those on Destruct instead.

Ah, sneaky little node. this works, thanks!

Also thanks for the array idea, should also work in case there’s something inside my scroll box that I don’t want to clear