Ukendio / jecs

A fast, portable Entity Component System for Luau
https://ukendio.github.io/jecs/
MIT License
121 stars 20 forks source link

[BUG] world:clear() does not invoke hooks #132

Open vnnh opened 4 days ago

vnnh commented 4 days ago

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