NateTheGreatt / bitECS

Flexible, minimal, data-oriented ECS library for Typescript
Mozilla Public License 2.0
944 stars 84 forks source link

Using `Changed` on tag components breaks deserialization #129

Open pietrovismara opened 10 months ago

pietrovismara commented 10 months ago

When I run this code:

const world = createWorld({}, 1e8);
const Empty = defineComponent({});
registerComponents(world, [Empty]);
const query = defineQuery([Empty]);

// bitecs throws here
const deser = pipe(query, defineSerializer([Changed(Empty)])); 

defineSerializer throws:

    const shadowStore = store[$parentArray].slice(0);
                                            ^

TypeError: Cannot read properties of undefined (reading 'slice')
    at createShadow (file:///home/dist/index.js:75:45)
pietrovismara commented 10 months ago

Possibly related to https://github.com/NateTheGreatt/bitECS/issues/71 ?