Skip to content

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

Merged
alice-i-cecile merged 4 commits intobevyengine:mainfrom
alice-i-cecile:ui-picking-feature
Feb 17, 2026
Merged

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

Conversation

@alice-i-cecile
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Feb 17, 2026
Merged via the queue into bevyengine:main with commit 052c272 Feb 17, 2026
44 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in UI Feb 17, 2026
@atlv24 atlv24 mentioned this pull request Feb 17, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Feb 17, 2026
# Objective

- #22933 removed the `bevy_picking` feature because it had the same
description as `picking` yet a different purpose. I believe this
different purpose is worth preserving and the fix is to document them
more adequately instead. The rest of the PR was good, i agree with
making it not enable `bevy_input_focus` when its enabled. Furthermore, I
would be in favor of a `picking_input_focus` feature.

## Solution

- Restore `bevy_picking` feature
- Adjust docs

## Testing

- ci

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
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: Done

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