-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-CrashA sudden unexpected crashA sudden unexpected crash
Description
bevy version: main 026563c
When spawning a camera and despawning it later it panics with
thread 'main' panicked at 'view entity should exist: QueryDoesNotMatch', [...]\crates\bevy_core_pipeline\src\main_pass_2d.rs:45:14
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(setup)
.add_system(remove_camera)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
}
fn remove_camera(
mut commands: Commands,
query: Query<Entity, With<Camera>>,
keyboard_input: Res<Input<KeyCode>>,
) {
if keyboard_input.just_pressed(KeyCode::Space) {
for entity in query.iter() {
commands.entity(entity).despawn();
}
}
}Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-CrashA sudden unexpected crashA sudden unexpected crash