Description
Bevy version
v0.16.1
What you did
Run commands from an observer.
What went wrong
I was expecting those commands to be executed before any other observer, instead several observers ran before the "previous" commands.
The stack nature of commands is critical for certain tasks. In my case, I want to fully solve one collision and its consequences before moving to the next one since I don't want my projectiles to hit more than one target.
Order I expected:
- Observer 1
- Command 1 from Observer 1
- Command 2 from Observer 1
- Observer 2
- Command 3 from Observer 2
- Command 4 from Observer 2
Order I got:
- Observer 1
- Observer 2
- Command 1 from Observer 1
- Command 2 from Observer 1
- Command 3 from Observer 2
- Command 4 from Observer 2
Additional information
It is easy to work around, now my observers only do one thing: run a single one-shot system. This way, all my logic now runs in command-land and the stack works as expected.
Order I have now:
- Observer 1
- Observer 2
- Command A from Observer 1
- Command 1 from Command A
- Command 2 from Command A
- Command B from Observer 2
- Command 3 from Command B
- Command 4 from Command B
Maybe this could also be the solution? Making observers insert a command instead of running their system directly?
In my case the consequence was that my game was crashing unexpectedly, since I was triggering new events and despawning entities. When unexpected ordering caused me to trigger an event on a despawned entity, the game crashed.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status