diff --git a/Cargo.toml b/Cargo.toml index 5f162b21a372f..f6850654f2a81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1609,17 +1609,6 @@ description = "Show how to use `apply_deferred` system" category = "ECS (Entity Component System)" wasm = false -[[example]] -name = "component_change_detection" -path = "examples/ecs/component_change_detection.rs" -doc-scrape-examples = true - -[package.metadata.example.component_change_detection] -name = "Component Change Detection" -description = "Change detection on components" -category = "ECS (Entity Component System)" -wasm = false - [[example]] name = "component_hooks" path = "examples/ecs/component_hooks.rs" @@ -2582,6 +2571,17 @@ description = "Demonstrates event propagation with observers" category = "ECS (Entity Component System)" wasm = true +[[example]] +name = "responding_to_changes" +path = "examples/ecs/responding_to_changes.rs" +doc-scrape-examples = true + +[package.metadata.example.reactivity] +name = "Responding to Changes" +description = "Demonstrates how and when to use change detection and `OnMutate` hooks and observers" +category = "ECS (Entity Component System)" +wasm = true + [[example]] name = "3d_rotation" path = "examples/transforms/3d_rotation.rs" diff --git a/examples/README.md b/examples/README.md index 56678ffd5ac25..fcc60d65c0c92 100644 --- a/examples/README.md +++ b/examples/README.md @@ -269,7 +269,6 @@ Example | Description Example | Description --- | --- -[Component Change Detection](../examples/ecs/component_change_detection.rs) | Change detection on components [Component Hooks](../examples/ecs/component_hooks.rs) | Define component hooks to manage component lifecycle events [Custom Query Parameters](../examples/ecs/custom_query_param.rs) | Groups commonly used compound queries and query filters into a single type [Custom Schedule](../examples/ecs/custom_schedule.rs) | Demonstrates how to add custom schedules diff --git a/examples/ecs/component_change_detection.rs b/examples/ecs/component_change_detection.rs deleted file mode 100644 index 096fb4a9fe60a..0000000000000 --- a/examples/ecs/component_change_detection.rs +++ /dev/null @@ -1,58 +0,0 @@ -//! This example illustrates how to react to component change. - -use bevy::prelude::*; -use rand::Rng; - -fn main() { - App::new() - .add_plugins(DefaultPlugins) - .add_systems(Startup, setup) - .add_systems( - Update, - (change_component, change_detection, tracker_monitoring), - ) - .run(); -} - -#[derive(Component, PartialEq, Debug)] -struct MyComponent(f32); - -fn setup(mut commands: Commands) { - commands.spawn(MyComponent(0.)); - commands.spawn(Transform::IDENTITY); -} - -fn change_component(time: Res