Skip to content
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

Added App::with_component_hooks #16977

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Fixed doctest not working
  • Loading branch information
Freya Pines authored and Freya Pines committed Dec 26, 2024
commit 2d7a143b52d750a92b3d0b2ec00a6b90460aa174
7 changes: 4 additions & 3 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,7 @@ impl App {
/// ```rust
/// # use bevy_app::prelude::*;
/// # use bevy_ecs::prelude::*;
/// # use bevy_ecs::component::ComponentHooks;
/// # use bevy_utils::default;
/// #
/// # let mut app = App::new();
Expand All @@ -1339,11 +1340,11 @@ impl App {
/// # struct MyComponent;
/// #
/// // An observer system can be any system where the first parameter is a trigger
/// app.with_component_hooks::<MyComponent>(|hooks: &mut ComponentHooks
/// hooks.on_add(|mut world: DeferredWorld<'_>, entity: Entity, component_id: ComponentId| {
/// app.with_component_hooks::<MyComponent>(|hooks: &mut ComponentHooks| {
/// hooks.on_add(|mut world, entity, component_id| {
/// println!("Component: {component_id:?} added to : {entity:?}");
/// });
/// })
/// });
/// ```
pub fn with_component_hooks<T>(
&mut self,
Expand Down