loop {
let Some(entity) = app.world().iter_entities().next() else {
break;
};
let entity = entity.id();
app.world_mut().despawn(entity);
}
Then there is no panic.
What went wrong
There is clearly a difference between calling World::despawn and World::clear_entities. Using the latter is causing the new observer logic to break safety in an unsafe block. Even if I'm not using bevy as intended here I shouldn't be able to do this with safe methods.
Bevy version
0.14.1
What you did
I keep an additional app in a non send resource (not a sub app) which is sent to an async compute task for physics rollback.
Before the task is started all entities are cleared
The app then updates once.
ScheduleRunnerPlugin
is not added to the app.Stack trace is here log.txt
If I replace
clear_entities()
withThen there is no panic.
What went wrong
There is clearly a difference between calling
World::despawn
andWorld::clear_entities
. Using the latter is causing the new observer logic to break safety in an unsafe block. Even if I'm not using bevy as intended here I shouldn't be able to do this with safe methods.