sprite picking not work with fullscreen ui node
Bevy version
The release number or commit hash of the version you're using.
0.15.0-rc.3 and lastest #e155fe1d
[Optional] Relevant system information
SystemInfo { os: "Linux rolling Arch Linux", kernel: "6.11.6-arch1-1", cpu: "AMD Ryzen 7 5800X 8-Core Processor", core_count: "8", memory: "31.3 GiB" }
AdapterInfo { name: "NVIDIA GeForce GTX 1060 3GB", vendor: 4318, device: 7044, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "565.57.01", backend: Vulkan }
What you did
bevy 2d add a sprite and observe click event and add a fullscreen ui above it .
[dependencies]
# bevy = { git = "https://github.com/bevyengine/bevy", features = ["bevy_sprite_picking_backend"]}
bevy = { version = "0.15.0-rc.3", features = ["bevy_sprite_picking_backend"] }
use bevy::prelude::*;
fn main() {
App::new().add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d::default());
commands
.spawn(Node {
width: Val::Percent(100.),
height: Val::Percent(100.),
justify_content: JustifyContent::SpaceBetween,
..default()
});
commands.spawn(Sprite::from_color(Color::WHITE, Vec2::new(100.0, 100.0))).observe(on_click);
}
fn on_click(trigger: Trigger<Pointer<Click>>,) {
println!("Clicked! {:?}", trigger);
}
What went wrong
click sprite should trigger event
Additional information
If add PickingBehavior::IGNORE to Node , the trigger will fire.
But it's unsound, default node should not block picking。 Other Type such as Button、 Sprite should default block picking。
Makes sense
That might be intentional design. Maybe someone wants to detect clicks on the invisible node. @NthTensor can you weigh in?
I don't have opinions about the default behavior for node. We could add it as a required component, and maybe either ignore or non-blocking make sense.
What was the original behviour in mod_picking?