Skip to content

Condense bevy_picking (input focus) feature into bevy_ui_picking feature#22933

Open
alice-i-cecile wants to merge 4 commits intobevyengine:mainfrom
alice-i-cecile:ui-picking-feature
Open

Condense bevy_picking (input focus) feature into bevy_ui_picking feature#22933
alice-i-cecile wants to merge 4 commits intobevyengine:mainfrom
alice-i-cecile:ui-picking-feature

Conversation

@alice-i-cecile
Copy link
Member

@alice-i-cecile alice-i-cecile commented Feb 13, 2026

Objective

The feature flags "bevy_picking" and "picking" have the same description despite fulfilling different goals. This is very confusing!

Fixes #22931.

The status quo before this PR.

  • picking is a feature collection in bevy, which enables ["bevy_picking", "mesh_picking", "sprite_picking", "ui_picking"].
  • the ui feature collection enables picking itself
  • bevy_picking is defined in bevy, which defers to ["bevy_internal/bevy_picking"]
  • in bevy_internal, this toggles bevy_picking = ["dep:bevy_picking", "bevy_input_focus?/bevy_picking"]
  • this then toggles the bevy_picking dependency (apparently that works as if it were a feature?) in bevy_input_focus
  • which is ultimately used to enable mouse / virtual cursor based input focus selection
  • @viridia is concerned about making this mandatory because of worries about observer overhead

Solution

Condense bevy_picking at the bevy_internal level into bevy_ui_picking. There's no way someone wants general UI picking but not input focus picking. This fixes the redundancy, and groups functionality more reasonably, while still making it possible to avoid UI picking as a whole off if you're concerned for whatever reason.

Users who want even more granularity than that can of course compose the various Bevy crates however they please.

Alternative

  1. Keep this feature around, renaming it to input_focus_picking.
  2. Enable that feature inside of ui_picking.

This adds another niche feature flag at the top level, but makes it easier for users who want to use bevy_input_focus without bevy_ui. I have never met such a user, but maybe they exist!

@github-actions
Copy link
Contributor

You added a new example but didn't add metadata for it. Please update the root Cargo.toml file.

@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Picking Pointing at and selecting objects of all sorts labels Feb 13, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in UI Feb 13, 2026
@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Feb 13, 2026
@alice-i-cecile alice-i-cecile added D-Straightforward Simple bug fixes and API improvements, docs, test and examples X-Contentious There are nontrivial implications that should be thought through labels Feb 13, 2026
Copy link
Contributor

@Smerom Smerom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good clarification and reasonable approach to me.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 13, 2026
Copy link
Contributor

@ickshonpe ickshonpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I've only had a quick look at this but there already two approvals and this makes sense to me. Not sure about the observer overhead concerns. If we could add some concrete benchmarks in a follow up, like a a many_ui_observers or something, that should help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Picking Pointing at and selecting objects of all sorts A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Contentious There are nontrivial implications that should be thought through

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

feature "bevy_picking" and "picking" have the same description despite fulfilling different goals, and unclear requirements for widget examples

4 participants