function Icon:destroy()
if self._destroyed then return end
IconController.iconRemoved:Fire(self)
self:clearNotices()
if self._parentIcon then
self:leave()
end
local function destroyDescendantIcons(parentIconToCheck)
local storageNames = {"dropdownIcons", "menuIcons"}
for _, storageName in pairs(storageNames) do
for _, childIcon in pairs(parentIconToCheck[storageName]) do
destroyDescendantIcons(childIcon)
childIcon:destroy()
end
end
end
destroyDescendantIcons(self)
self._destroyed = true
self._maid:clean()
end
[ ] Also fix this bug when resetOnSpawn false and destroying dropdown: