Engine queues entity add / remove operations during update but they are not processed in order.
BryceCicada opened this issue · 1 comments
BryceCicada commented
Hi,
I have a collision system. On collision, I reset my game. To reset, I use the same Engine with the same EntitySystems already added. I just call
mGameEngine.removeAllEntities();
mGameEngine.addEntity(new Entity1());
mGameEngine.addEntity(new Entity2());
etc
This does not work as intended.
Upon investigation, it seems that because this is invoked from within a system during the update of the engine, these add / remove operations are stored on the Engine for processing at the end of the update. A private Engine field, entityOperations, holds the operations. When these are processed, they are not processed in order.
Shouldn't entityOperations be processed first in, first out?