diff --git a/examples/hooks/cleanup.luau b/examples/hooks/cleanup.luau index 9088ad2..d0c91bd 100755 --- a/examples/hooks/cleanup.luau +++ b/examples/hooks/cleanup.luau @@ -13,8 +13,9 @@ world:set(Model, jecs.OnRemove, function(entity) model:Destroy() end) -world:set(Model, jecs.OnSet, function(entity, model) - -- OnSet is invoked after the data has been assigned. +world:set(Model, jecs.OnAdd, function(entity, id, model) + -- OnAdd is invoked after the data has been assigned. + -- This hook only fires the first time the component is added. -- It also returns the data for faster access. -- There may be some logic to do some side effects on reassignments model:SetAttribute("entityId", entity)