bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
34.78k stars 3.4k forks source link

Could not insert a bundle (of type `bevy_a11y::AccessibilityNode`) #9821

Open Indy2222 opened 11 months ago

Indy2222 commented 11 months ago

Bevy version

0.11.2

[Optional] Relevant system information

What you did

I was viciously clicking a UI button.

What went wrong

Unexpected panic:

thread 'main' panicked at 'error[B0003]: Could not insert a bundle (of type `bevy_a11y::AccessibilityNode`) for entity 105v6 because it doesn't exist in this World.', /home/indy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.11.2/src/system/commands/mod.rs:957:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic when applying buffers for system `bevy_ui::accessibility::button_changed`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
mockersf commented 11 months ago

Could you share a reproducer? This error message means that an entity was despawned, but clicking a button by itself shouldn't despawn anything.

Indy2222 commented 11 months ago

I was not able to reproduce the issue myself so I do not have any small reproducer. It looks like the bundle was inserted by Bevy.

This is the button I was clicking https://github.com/DigitalExtinction/Game/blob/7202732eb9d1c9afbde1041476c68c585c368333/crates/controller/src/hud/actionbar.rs#L109

rparrett commented 11 months ago

Thanks, that's helpful.

At a glance, it seems probably that this is some sort of system ordering issue between bevy's accessibility systems (button_changed) and the update in digital extinction which are both running in the PostUpdate schedule.

I would guess that spawning a button after button_changed and despawning it the next frame before the accessibility node is added could cause this. edit: not able to confirm this guess.

It would be nice to be able to confirm this with a minimal reproducer.