Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 752 Bytes

File metadata and controls

34 lines (27 loc) · 752 Bytes
title `bevy_ui_widgets::observe` has been deprecated in favor of `bsn!`
pull_requests
TODO

The observe function and AddObserver struct in bevy_ui_widgets have been deprecated. These were a workaround for attaching observers as bundle effects. Now that bsn! supports the on helper natively, use that instead.

Before:

use bevy_ui_widgets::observe;

commands.spawn((
    Button,
    observe(|_event: On<Pointer<Press>>| {
        println!("Clicked!");
    }),
));

After:

commands.spawn(bsn! {
    Button
    on(|_event: On<Pointer<Press>>| {
        println!("Clicked!");
    })
});

If you were using AddObserver directly for some reason, replace it with on inside a bsn! block in the same way.