core
core copied to clipboard
Destroyed components are still found by getComponent
It seems that after destroying a component either by removing the tag or by destroying the instance, the component is not actually removed from memory.
const components = Dependency<Components>();
const myComponent = components.getComponent<MyComponent>(game);
Still finds the component and can use it. A workaround could to add a "destroyed" flag to the component class (which gets flipped when destroy() is run), but it troubles me that this deleted component is still using memory and potentially a performance issue.