You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Query transformer skipping entities that have not been either mutated or added since the last pass of the system
From the following workarounds, it seems to depend on the order of execution of the systems. The state of entities seems to be reseted near the end, and spawning does not happen when the system is executed but later.
Should the documentation be updated to specify that it only concerns changes in the current loop run, or can the Changed query actually keep track of changed since the last execution of the system where it's used?
This is expected behavior. The current change detection system is very cheap, which is why we can enable it by default. But it comes at the cost that changes are only detected in "downstream" systems and they are reset at the end of each update.
#68 outlines the issue and links to some additional thoughts on it. the only "fix" for this is to maintain per-system change state across frames, but this would require additional allocations and would significantly increase the cost of change detection. Its worth considering adding "opt in" cross frame change detection, but I dont think we can justify the cost of making it the default.
Unfortunately the docs are slightly incorrect (as you pointed out). We should fix those (which ill consider the close-criteria for this issue).
using branch master at 5f1fef3:
in the following example:
The
check_for_changed
system is only called for the component spawned in the startup system.This was not what I expected since the documentation for
Changed
states thatFrom the following workarounds, it seems to depend on the order of execution of the systems. The state of entities seems to be reseted near the end, and spawning does not happen when the system is executed but later.
Should the documentation be updated to specify that it only concerns changes in the current loop run, or can the
Changed
query actually keep track of changed since the last execution of the system where it's used?workarounds
If I change the order of my systems so that
check_for_changed
is afterchange_a
, it will be triggered for changes but not for spawns.If I put the system in the stage
bevy::app::stage::POST_UPDATE
, it now catches both spawning and changes.The text was updated successfully, but these errors were encountered: