Skip to content

1-frame hover delay on newly-spawned entities #19050

Open
@benfrankel

Description

@benfrankel

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:

2025-05-03.15-06-45.mp4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    Status

    Widget-ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions