core icon indicating copy to clipboard operation
core copied to clipboard

Destroyed components are still found by getComponent

Open Shadercloud opened this issue 6 months ago • 0 comments

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.

Shadercloud avatar Oct 22 '25 11:10 Shadercloud