Skip to content

Commit 0ee8bf9

Browse files
authored
Clarify Resource change detection behaviour in condition docs (#19252)
# Objective Fixes #17933 ## Solution Correct "value has changed'" in docs to "value has been added or mutably dereferenced", with a note for emphasis copied from the docs for Changed. ## Testing -
1 parent 6c003ef commit 0ee8bf9

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

crates/bevy_ecs/src/schedule/condition.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -610,12 +610,11 @@ pub mod common_conditions {
610610
}
611611

612612
/// A [`SystemCondition`]-satisfying system that returns `true`
613-
/// if the resource of the given type has had its value changed since the condition
614-
/// was last checked.
613+
/// if the resource of the given type has been added or mutably dereferenced
614+
/// since the condition was last checked.
615615
///
616-
/// The value is considered changed when it is added. The first time this condition
617-
/// is checked after the resource was added, it will return `true`.
618-
/// Change detection behaves like this everywhere in Bevy.
616+
/// **Note** that simply *mutably dereferencing* a resource is considered a change ([`DerefMut`](std::ops::DerefMut)).
617+
/// Bevy does not compare resources to their previous values.
619618
///
620619
/// # Panics
621620
///
@@ -664,14 +663,11 @@ pub mod common_conditions {
664663
}
665664

666665
/// A [`SystemCondition`]-satisfying system that returns `true`
667-
/// if the resource of the given type has had its value changed since the condition
666+
/// if the resource of the given type has been added or mutably dereferenced since the condition
668667
/// was last checked.
669668
///
670-
/// The value is considered changed when it is added. The first time this condition
671-
/// is checked after the resource was added, it will return `true`.
672-
/// Change detection behaves like this everywhere in Bevy.
673-
///
674-
/// This run condition does not detect when the resource is removed.
669+
/// **Note** that simply *mutably dereferencing* a resource is considered a change ([`DerefMut`](std::ops::DerefMut)).
670+
/// Bevy does not compare resources to their previous values.
675671
///
676672
/// The condition will return `false` if the resource does not exist.
677673
///
@@ -724,15 +720,11 @@ pub mod common_conditions {
724720
}
725721

726722
/// A [`SystemCondition`]-satisfying system that returns `true`
727-
/// if the resource of the given type has had its value changed since the condition
723+
/// if the resource of the given type has been added, removed or mutably dereferenced since the condition
728724
/// was last checked.
729725
///
730-
/// The value is considered changed when it is added. The first time this condition
731-
/// is checked after the resource was added, it will return `true`.
732-
/// Change detection behaves like this everywhere in Bevy.
733-
///
734-
/// This run condition also detects removal. It will return `true` if the resource
735-
/// has been removed since the run condition was last checked.
726+
/// **Note** that simply *mutably dereferencing* a resource is considered a change ([`DerefMut`](std::ops::DerefMut)).
727+
/// Bevy does not compare resources to their previous values.
736728
///
737729
/// The condition will return `false` if the resource does not exist.
738730
///

0 commit comments

Comments
 (0)