//! A minimal 2d example. use bevy::{prelude::*, sprite::MaterialMesh2dBundle}; use bevy_color::palettes; use bevy_mod_picking::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins.set(low_latency_window_plugin())) .add_plugins(DefaultPickingPlugins) .insert_resource(DebugPickingMode::Normal) .add_systems(Startup, setup) .run(); } /// Set up a simple 2D scene fn setup( mut commands: Commands, mut meshes: ResMut>, mut materials: ResMut>, ) { commands.spawn(Camera2dBundle::default()); commands.spawn(( MaterialMesh2dBundle { mesh: meshes.add(Rectangle::default()).into(), transform: Transform::default().with_scale(Vec3::splat(128.)), material: materials.add(ColorMaterial::from(Color::from(palettes::basic::PURPLE))), ..default() }, PickableBundle::default(), // <- Makes the mesh pickable. )); }