diff --git a/Sane Eric's UI/DynamicList.cs b/Sane Eric's UI/DynamicList.cs index acb1a482892427680f59d70d54aea0cb11e74ca4..26c6387a26047b7f8e255f68fbce96f37c00e67c 100644 --- a/Sane Eric's UI/DynamicList.cs +++ b/Sane Eric's UI/DynamicList.cs @@ -48,13 +48,19 @@ namespace Shared.SEUI { // Remove the given item from the list (if it is in the list) public void RemoveItem(TValueType item) { if (listItems.ContainsKey(item)) { - Destroy(listItems[item].gameObject); + var itemUI = listItems[item]; listItems.Remove(item); + OnItemRemoved(item, itemUI); + Destroy(itemUI.gameObject); } } // -------------------------------------------------------------------------- // Implement if the list needs to do something to the DynamicListItem after it has been added to the list - protected virtual void OnItemAdded(TValueType item, TDynamicListItem itemUI) { } + protected virtual void OnItemAdded(TValueType item, TDynamicListItem itemUI) {} + + // -------------------------------------------------------------------------- + // Implement if the list needs to do something to the DynamicListItem after it has been removed from the list + protected virtual void OnItemRemoved(TValueType item, TDynamicListItem itemUI) {} } }