Skip to content

Commit 2f0f817

Browse files
committed
Optimize remove
1 parent f9e0aa0 commit 2f0f817

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/init.luau

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ end
512512

513513

514514
local function archetype_traverse_remove(world: World, componentId: i53, from: Archetype): Archetype
515-
from = from or world.ROOT_ARCHETYPE
516515
local edge = edge_ensure(from, componentId)
517516

518517
local remove = edge.remove
@@ -534,6 +533,9 @@ local function world_remove(world: World, entityId: i53, componentId: i53)
534533
local entityIndex = world.entityIndex
535534
local record = entityIndex.sparse[entityId]
536535
local sourceArchetype = record.archetype
536+
if not sourceArchetype then
537+
return
538+
end
537539
local destinationArchetype = archetype_traverse_remove(world, componentId, sourceArchetype)
538540

539541
if sourceArchetype and not (sourceArchetype == destinationArchetype) then

0 commit comments

Comments
 (0)