Fix panic in mesh picking when a mesh is RENDER_WORLD only#22356
Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom Jan 5, 2026
Merged
Conversation
Contributor
Author
|
Adding to the 0.18 milestone - the reporting issue is tagged as 0.18, and the bug it fixes is a panic introduced in 0.18. |
kfc35
approved these changes
Jan 3, 2026
Contributor
kfc35
left a comment
There was a problem hiding this comment.
LGTM for correctness, checked out this branch and verified that the example does not crash with this code
Contributor
|
code is fine. to consider it properly closed i think we should or |
JMS55
approved these changes
Jan 3, 2026
cart
pushed a commit
that referenced
this pull request
Jan 8, 2026
## Objective Fix a panic in mesh picking if a mesh is `RenderAssetUsages::RENDER_WORLD` only. The panic was reported in #22206, although that issue is framed as a broader concern and so is not resolved by this PR. The problem was introduced in #21732. ## Solution Changed mesh accesses to use the non-panicking `try_` variants. This means extracted meshes are silently ignored as before. I also did a quick scan to see if could spot any other engine crates that might have the same issue - didn't see any but could easily have missed one. ## Testing Tested by modifying the `mesh_picking` example: ```diff + let mut p = Mesh::from(Cuboid::default()); + p.asset_usage = bevy_asset::RenderAssetUsages::RENDER_WORLD; let shapes = [ - meshes.add(Cuboid::default()), + meshes.add(p), ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Fix a panic in mesh picking if a mesh is
RenderAssetUsages::RENDER_WORLDonly. The panic was reported in #22206, although that issue is framed as a broader concern and so is not resolved by this PR. The problem was introduced in #21732.Solution
Changed mesh accesses to use the non-panicking
try_variants. This means extracted meshes are silently ignored as before.I also did a quick scan to see if could spot any other engine crates that might have the same issue - didn't see any but could easily have missed one.
Testing
Tested by modifying the
mesh_pickingexample: