If you cannot get Bevy to build or run on your machine, please include:
Rustc 1.70.0-nightly
Endeavour OS
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
thread 'Compute Task Pool (0)' panicked at 'called `Result::unwrap()` on an `Err` value: NoEntities("bevy_ecs::query::state::QueryState<bevy_ecs::entity::Entity, bevy_ecs::query::filter::With<bevymon::chat::components::ChatBoxText>>")', src/chat/controller.rs:43:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (0)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', /home/stanley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.10.0/src/schedule/executor/multi_threaded.rs:194:60
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/stanley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.10.0/src/task_pool.rs:376:49
What you did
I'm trying to despawn two entities, I made sure that if I debug it, the entity already exists e.g. showing the ID on log and it renders on Egui. The below code works:
However when I tried with the below code it doesn't working:
use bevy::prelude::*;
use super::components::*;
use super::resource::ChatResource;
#[derive(Debug)]
pub struct Chat;
impl Chat {
pub fn new(
chat_res: Res<ChatResource>,
mut commands: Commands,
asset_server: Res<AssetServer>,
texture_atlas_res: ResMut<Assets<TextureAtlas>>,
window_query: Query<&Window>,
) {
let window = window_query.single();
let chatbox_name = Name::new("Chatbox");
let chatbox = ChatBoxSprite::new(&asset_server, texture_atlas_res, window);
let chattext_name = Name::new("ChatText");
let chattext = ChatBoxText::new(
&asset_server,
window,
&chat_res.dialgoues[chat_res.dialogue_index],
);
commands
.spawn((chatbox_name, chatbox))
.insert(ChatBoxSprite);
commands
.spawn((chattext_name, chattext))
.insert(ChatBoxText);
}
pub fn next_dialogue(
keyboard: Res<Input<KeyCode>>,
mut commands: Commands,
query: Query<Entity, With<ChatBoxText>>,
) {
if keyboard.pressed(KeyCode::Z) {
let entity = query.single();
commands.entity(entity).despawn();
}
}
}
It throws the following error:
thread 'Compute Task Pool (0)' panicked at 'called `Result::unwrap()` on an `Err` value: NoEntities("bevy_ecs::query::state::QueryState<bevy_ecs::entity::Entity, bevy_ecs::query::filter::With<bevymon::chat::components::ChatBoxText>>")', src/chat/controller.rs:43:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (0)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', /home/stanley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.10.0/src/schedule/executor/multi_threaded.rs:194:60
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/stanley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.10.0/src/task_pool.rs:376:49
As the error message says, it got err value with no entities but when I debug it on log the entity is showing its ID, I'm not sure which part is my fault on despawning it, does anybody have similar issue?
Bevy version
Bevy 0.10
[Optional] Relevant system information
If you cannot get Bevy to build or run on your machine, please include:
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
What you did
I'm trying to despawn two entities, I made sure that if I debug it, the entity already exists e.g. showing the ID on log and it renders on Egui. The below code works:
What went wrong
However when I tried with the below code it doesn't working:
It throws the following error:
As the error message says, it got err value with no entities but when I debug it on log the entity is showing its ID, I'm not sure which part is my fault on despawning it, does anybody have similar issue?