NateTheGreatt/bitECS

Resizing smaller than the defaultSize always errors

krispya opened this issue · 0 comments

In all cases I tested, resizing smaller than the defaultSize produced an error.

const bitWorld = createWorld(); // Turns out default is 100000
setDefaultSize(5000); // Errors

Likewise if I tried setting it in createWorld, the components still instantiated with a default 100,000 entities:

const bitWorld = createWorld(5000); // New components still are TypedArray(100000) 

Lastly, I tried with defineComponent but this also errors.

// defaultSize is 100000
defineComponent({..}, 5000); // Errors

My workaround has been to start with the smallest world size and only grow when needed.

const bitWorld = createWorld(1);
setDefaultSize(5000);