Fix doc for Added, Changed (#13458)
# Objective Fixes #13426 ## Solution Correct documentation to describe current behavior --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
151e198d94
commit
6c95d54652
@ -765,6 +765,8 @@ impl Components {
|
||||
|
||||
/// A value that tracks when a system ran relative to other systems.
|
||||
/// This is used to power change detection.
|
||||
///
|
||||
/// *Note* that a system that hasn't been run yet has a `Tick` of 0.
|
||||
#[derive(Copy, Clone, Default, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))]
|
||||
pub struct Tick {
|
||||
@ -869,13 +871,15 @@ pub struct ComponentTicks {
|
||||
}
|
||||
|
||||
impl ComponentTicks {
|
||||
/// Returns `true` if the component or resource was added after the system last ran.
|
||||
/// Returns `true` if the component or resource was added after the system last ran
|
||||
/// (or the system is running for the first time).
|
||||
#[inline]
|
||||
pub fn is_added(&self, last_run: Tick, this_run: Tick) -> bool {
|
||||
self.added.is_newer_than(last_run, this_run)
|
||||
}
|
||||
|
||||
/// Returns `true` if the component or resource was added or mutably dereferenced after the system last ran.
|
||||
/// Returns `true` if the component or resource was added or mutably dereferenced after the system last ran
|
||||
/// (or the system is running for the first time).
|
||||
#[inline]
|
||||
pub fn is_changed(&self, last_run: Tick, this_run: Tick) -> bool {
|
||||
self.changed.is_newer_than(last_run, this_run)
|
||||
|
@ -514,13 +514,15 @@ macro_rules! impl_tuple_query_filter {
|
||||
all_tuples!(impl_tuple_query_filter, 0, 15, F);
|
||||
all_tuples!(impl_or_query_filter, 0, 15, F, S);
|
||||
|
||||
/// A filter on a component that only retains results added after the system last ran.
|
||||
/// A filter on a component that only retains results the first time after they have been added.
|
||||
///
|
||||
/// A common use for this filter is one-time initialization.
|
||||
///
|
||||
/// To retain all results without filtering but still check whether they were added after the
|
||||
/// system last ran, use [`Ref<T>`](crate::change_detection::Ref).
|
||||
///
|
||||
/// **Note** that this includes changes that happened before the first time this `Query` was run.
|
||||
///
|
||||
/// # Deferred
|
||||
///
|
||||
/// Note, that entity modifications issued with [`Commands`](crate::system::Commands)
|
||||
@ -716,7 +718,7 @@ impl<T: Component> QueryFilter for Added<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A filter on a component that only retains results added or mutably dereferenced after the system last ran.
|
||||
/// A filter on a component that only retains results the first time after they have been added or mutably dereferenced.
|
||||
///
|
||||
/// A common use for this filter is avoiding redundant work when values have not changed.
|
||||
///
|
||||
@ -726,6 +728,8 @@ impl<T: Component> QueryFilter for Added<T> {
|
||||
/// To retain all results without filtering but still check whether they were changed after the
|
||||
/// system last ran, use [`Ref<T>`](crate::change_detection::Ref).
|
||||
///
|
||||
/// **Note** that this includes changes that happened before the first time this `Query` was run.
|
||||
///
|
||||
/// # Deferred
|
||||
///
|
||||
/// Note, that entity modifications issued with [`Commands`](crate::system::Commands)
|
||||
|
Loading…
Reference in New Issue
Block a user