-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix Changed
docs with advantages and drawbacks
#3084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -616,18 +616,27 @@ impl_tick_filter!( | |
); | ||
|
||
impl_tick_filter!( | ||
/// Filter that retrieves components of type `T` that have been changed since the last | ||
/// execution of this system. | ||
/// Filter that retrieves components of type `T` that have been changed since the last tick. | ||
/// | ||
/// This filter is useful for synchronizing components, and as a performance optimization as it | ||
/// means that the query contains fewer items for a system to iterate over. | ||
/// All components internally remember the last tick they were added at, and the last tick they | ||
/// were mutated at. The mutation detection is powered by `DerefMut`, such that any dereferencing | ||
/// will mark the component as changed. Note that there is no deep value inspection on the actual | ||
/// data of the component, which would be prohibitively expensive. This means false positives can | ||
/// occur if dereferencing via `DerefMut` but not changing any component data. | ||
/// | ||
/// Because the ordering of systems can change and this filter is only effective on changes | ||
/// before the query executes you need to use explicit dependency ordering or ordered | ||
/// stages to avoid frame delays. | ||
/// This filter is useful for synchronizing components. It can also be used as a performance | ||
/// optimization in case of expensive operations, by filtering unchanged components out and | ||
/// returning via the query only the components which changed. However, note that like all | ||
/// filterings, applying this filtering has a small cost, which must be balanced against the | ||
/// cost of the operation on the changed components. | ||
/// | ||
/// If instead behavior is meant to change on whether the component changed or not | ||
/// [`ChangeTrackers`](crate::query::ChangeTrackers) may be used. | ||
/// Because by default the ordering of systems can change, and this filter is only effective | ||
djeedai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// on changes detected before the query executes, to avoid frame delays you need to use | ||
/// explicit dependency ordering or ordered stages to ensure the detecting system where the | ||
/// query is used runs after the system(s) which mutate the component. | ||
/// | ||
/// To instead retrieve all components without filtering but allow querying if they changed | ||
/// or not since last tick, you can use [`ChangeTrackers`](crate::query::ChangeTrackers). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or just use |
||
/// | ||
/// # Examples | ||
/// | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.