Ukendio / jecs

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

Fix component overriding when in disorder #15

Closed Ukendio closed 6 months ago

Ukendio commented 6 months ago

Previously setting the components in different order results in it overriding component data?

This happened because it incorrectly mapped the index of the column. So it took the index from the source archetype rather than the destination archetype. Essentially changing it to this will fix it:

local targetColumn = destinationColumns[destinationArchetype.records[types[i]]