-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
A-GizmosVisual editor and debug gizmosVisual editor and debug gizmosA-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-RegressionFunctionality that used to work but no longer does. Add a test for this!Functionality that used to work but no longer does. Add a test for this!S-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong
Milestone
Description
Bevy version
Relevant system information
Rust version: 1.78.0
System info:
2024-05-15T18:44:46.562458Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 39 Nobara Linux", kernel: "6.8.7-201.fsync.fc39.x86_64", cpu: "AMD Ryzen 7 7840HS w/ Radeon 780M Graphics", core_count: "8", memory: "30.6 GiB" }Adapter info:
AdapterInfo { name: "AMD Radeon RX 6650M (RADV NAVI23)", vendor: 4098, device: 29679, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 24.2.0-devel", backend: Vulkan }What you did
Setup a point to be deleted when the mouse button is pressed anywhere, draw the point with a circle gizmo.
What went wrong
- Expecting gizmo to no longer draw despawned entity
- Despawned entity is still drawn
use bevy::prelude::*;
#[derive(Component)]
struct Point(Vec2);
fn setup(mut cmds: Commands) {
cmds.spawn(Camera2dBundle::default());
cmds.spawn(Point(Vec2::new(0.0, 150.0)));
}
fn draw(mut gizmos: Gizmos, tree: Query<&Point>) {
for Point(pos) in tree.iter() {
gizmos.circle_2d(*pos, 40., Color::WHITE);
}
}
fn despawn(
mut cmds: Commands,
points: Query<Entity, With<Point>>,
mouse_buttons: Res<ButtonInput<MouseButton>>,
) {
if mouse_buttons.just_pressed(MouseButton::Left) {
for entity in points.iter() {
println!("despawned");
cmds.entity(entity).despawn();
}
}
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.add_systems(Update, (draw, despawn).chain())
.run();
}Metadata
Metadata
Assignees
Labels
A-GizmosVisual editor and debug gizmosVisual editor and debug gizmosA-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-RegressionFunctionality that used to work but no longer does. Add a test for this!Functionality that used to work but no longer does. Add a test for this!S-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong