| Crates.io | bevy_spawn_observer |
| lib.rs | bevy_spawn_observer |
| version | 0.3.0 |
| created_at | 2025-04-23 11:11:06.579191+00 |
| updated_at | 2026-01-23 21:37:44.569555+00 |
| description | Add observers to your bundles |
| homepage | |
| repository | https://github.com/benfrankel/bevy_spawn_observer |
| max_upload_size | |
| id | 1645386 |
| size | 132,189 |
[!WARNING] This crate is no longer maintained and will not be updated to new versions of Bevy past 0.18.
You can already use the experimental
bevy::ui_widgets::observesince 0.17, and a proper upstream solution is expected to land at some point (see #14204 and #17607).
This crate provides SpawnObserver,
a custom SpawnableList
enabling you to add observers to your bundles.
use bevy::{ecs::spawn::SpawnWith, prelude::*};
use bevy_spawn_observer::SpawnObserver;
// With `bevy_spawn_observer`:
fn button_new() -> impl Bundle {
(
Button,
Children::spawn(SpawnObserver::new(|_: Trigger<Pointer<Click>>| {
info!("You clicked me!");
})),
)
}
// Without `bevy_spawn_observer`:
fn button_old() -> impl Bundle {
(
Node::default(),
Children::spawn(SpawnWith(|parent: &mut ChildSpawner| {
parent.spawn(Button).observe(|_: Trigger<Pointer<Click>>| {
info!("You clicked me!");
});
})),
)
}
See a full example here.
bevy version |
bevy_spawn_observer version |
|---|---|
| 0.18 | 0.3 |
| 0.17 | 0.2 |
| 0.16 | 0.1 |
This crate is available under either of MIT or Apache-2.0 at your choice.