Calling world:clear(id) does not invoke any OnRemove hooks for components that the entity might have.
local component = world:component()
world:set(component,jecs.OnAdd,function()
print("added")
end)
world:set(component,jecs.OnRemove,function()
print("removed")
end)
local entity = world:entity()
world:add(entity,component)
world:clear(entity)
-- only prints added
-- changing the :clear() to :delete() prints removed as expected
Calling
world:clear(id)
does not invoke any OnRemove hooks for components that the entity might have.