-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spawing many Entities and then despawing them leads to NoSuchEntity. #369
Comments
I confirmed I see the same thing on mac with the current master commit of 3efbaca Here is an even more stripped down example (I just deleted more things from the example provided above). |
Most likely related to #117. |
The example project I provided still panics. |
Are you using the git version of bevy or the crates.io version? |
The git, have you tried the example project? |
Yeah it was what I used to check that the PR fixed the issue it says it does x) |
Be sure to |
Everything look OK! |
Ah oops cargo update, yeah this makes sense. Glad it's working for you now ^-^ |
Just to inform you, I got the bug again in my project. |
You'll get the same error message if you despawn the same entity twice (And from some other functions, a stacktrace would be useful if wishing to determine the actual cause :) ). Could be that |
I just found the problem and it was mine. |
Not a problem! I'm glad you followed up, even if it ended up being on your side. It could have been an issue with bevy, and we want to fix issues with bevy 😄 |
I was trying to create a minimal project for another problem an I came upon this.
The minimal example project is the example ui/text with those lines:
`struct Item {
max_time: f32,
time: f32,
}
fn add_items(mut commands: Commands) {
for _ in 0..1000 {
commands.spawn((Item {max_time: 1.0, time: 0.0}, ));
}
}
fn update_items(mut commands: Commands, time: Res, mut query: Query<(&mut Item, Entity)>) {
let mut num = 0;
for (mut item, e) in &mut query.iter() {
num += 1;
item.time += time.delta_seconds;
if item.time >= item.max_time {
commands.despawn(e);
}
}
println!("number of items : {}", num);
}`
After a while I get:
thread 'main' panicked at 'called
Result::unwrap()on an
Errvalue: NoSuchEntity', C:\Users\kakoeimon\.cargo\git\checkouts\bevy-f7ffde730c324c74\89a1d36\crates\bevy_ecs\src\system\commands.rs:75:36 note: run with
RUST_BACKTRACE=1environment variable to display a backtrace error: process didn't exit successfully:
target\debug\no_such_entity.exe(exit code: 101)
The minimal example project
no_such_entity.zip
The text was updated successfully, but these errors were encountered: