1-frame hover delay on newly-spawned entities
Open
A-UI
C-Bug
D-Straightforward
S-Ready-For-Implementation
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
0.16.0
## What you did
Spawn a UI node directly under the user's cursor that changes its background color based on interaction state.
## What went wrong
The frame that it spawns in, it has `Interaction::None` despite being under the user's cursor, so it flashes that color for 1 frame and then becomes `Interaction::Hover` the next frame.
Demonstration with colors changed for clarity:
https://github.com/user-attachments/assets/ad9785f0-7980-46e7-a38e-69cb569b1307
This seems to be because `ui_focus_system` iterates over `UiStack` to find hovered entities, but `UiStack` is not updated for the frame until `ui_stack_system` runs in `PostUpdate`.
Contributor guide
Assessment
This issue has not been assessed yet.