When calling Detach() to remove a component, the entity is not updated until the next Update of the EntityManager.
For example:
When I Detach a component in a EntityProcessingSystem, the component bit is still set in the next EntityDrawSystem Update and the entity is still part of the ActiveEntities which might crash the code.
A quick and dirty solution is to modify EntityManager.OnComponentsChanged to:
When calling Detach() to remove a component, the entity is not updated until the next Update of the EntityManager.
For example:
When I Detach a component in a EntityProcessingSystem, the component bit is still set in the next EntityDrawSystem Update and the entity is still part of the ActiveEntities which might crash the code.
A quick and dirty solution is to modify EntityManager.OnComponentsChanged to: