bevy_spawn_observer 0.1.0-rc.1

Add observers to your bundles
Documentation

bevy_spawn_observer

Crates.io Docs License

This crate provides SpawnObserver, a custom SpawnableList for spawning observers, which enables you to add observers to your bundles.

use bevy::prelude::*;
use bevy_spawn_observer::SpawnObserver;

fn button() -> impl Bundle {
    (
        Button,
        Children::spawn(SpawnObserver::new(|_: Trigger<Pointer<Click>>| {
            info!("You clicked me!");
        })),
    )
}

Check out a full example of how this looks in practice.

Bevy version compatibility

bevy version bevy_spawn_observer version
0.16 0.1 (unreleased)

License

This crate is available under either of MIT or Apache-2.0 at your choice.