diff --git a/crates/bevy_ecs/src/change_detection.rs b/crates/bevy_ecs/src/change_detection.rs index f0b863fc86..d4cc1a73af 100644 --- a/crates/bevy_ecs/src/change_detection.rs +++ b/crates/bevy_ecs/src/change_detection.rs @@ -131,6 +131,12 @@ pub trait DetectChangesMut: DetectChanges { /// This is useful to ensure change detection is only triggered when the underlying value /// changes, instead of every time it is mutably accessed. /// + /// If you're dealing with non-trivial structs which have multiple fields of non-trivial size, + /// then consider applying a `map_unchanged` beforehand to allow changing only the relevant + /// field and prevent unnecessary copying and cloning. + /// See the docs of [`Mut::map_unchanged`], [`MutUntyped::map_unchanged`], + /// [`ResMut::map_unchanged`] or [`NonSendMut::map_unchanged`] for an example + /// /// If you need the previous value, use [`replace_if_neq`](DetectChangesMut::replace_if_neq). /// /// # Examples @@ -181,6 +187,12 @@ pub trait DetectChangesMut: DetectChanges { /// This is useful to ensure change detection is only triggered when the underlying value /// changes, instead of every time it is mutably accessed. /// + /// If you're dealing with non-trivial structs which have multiple fields of non-trivial size, + /// then consider applying a [`map_unchanged`](Mut::map_unchanged) beforehand to allow + /// changing only the relevant field and prevent unnecessary copying and cloning. + /// See the docs of [`Mut::map_unchanged`], [`MutUntyped::map_unchanged`], + /// [`ResMut::map_unchanged`] or [`NonSendMut::map_unchanged`] for an example + /// /// If you don't need the previous value, use [`set_if_neq`](DetectChangesMut::set_if_neq). /// /// # Examples