#Observer Execution Timing Question (PR not merged yet)

3 messages · Page 1 of 1 (latest)

vale stag
#

Hello!
I have been looking over the PR and am generally excited about the feature. I wanted to clarify the timing of the observer execution. Take these systems for example:

(
system_a.before(system_b),
system_b,
)

Through Commands, if system_a causes an observer to be triggered, would the observer code get executed after system_a, before system_b, and would system_b see the results of the observer code execution?

https://github.com/bevyengine/bevy/pull/10839
https://bevyengine.org/news/bevy-0-13/#automatically-insert-apply-deferred-systems

GitHub

Objective

Provide an expressive way to register dynamic behavior in response to ECS changes that is consistent with existing bevy types and traits as to provide a smooth user experience.
Provide a...

glad bay
#

I believe this depends on the arguments of system_a and system_b and whether a sync point gets auto-inserted between them. For example in ```rust
(
system_a,
apply_deferred,
system_b,
).chain()

the observer would be executed between them (so after `system_a` and before `system_b`) and `system_b` would see the observers behaviour
#

Whereas

(
system_a.before_ignore_deferred(system_b),
system_b,
)

would be unspecified because it depends on if something else happens to place a sync point in between these two functions (and could in theory change between compiles of the same program). If these were the only two functions (or just no sync point gets placed) then the observer would trigger after system_b and therefore it wouldn't see its changes