Skip to content

Conversation

@mirsella
Copy link
Contributor

@mirsella mirsella commented Jan 7, 2026

Objective

fixes #22413
from this issue:

currently, with SpritePickingMode::AlphaThreshold sprite picking silently fail on image format like bc7, uastc, etc, since its not possible to get the pixel alpha value at a specific location, as the image is compressed in memory. currently the code break the loop and silently skip picking for the sprite.
#20574 made it not panic anymore

its very hard to debug why a sprite picking doesn't work when encountering this issue, i think a warn is really useful.

Solution

add a warn! log

Testing

tested on my own project

is the log message adapted ?

thanks

@mirsella
Copy link
Contributor Author

mirsella commented Jan 7, 2026

hm this requires adding bevy_log dep to bevy_sprite, dunno if thats acceptable ?

Copy link
Contributor

@JMS55 JMS55 left a comment

Choose a reason for hiding this comment

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

Approved with one nit. Adding bevy_log dep is fine.

@mirsella mirsella marked this pull request as draft January 7, 2026 19:51
@mirsella
Copy link
Contributor Author

mirsella commented Jan 7, 2026

im getting this warn even when not using compressed assets because of another problem
bevy_sprite::picking_backend: Failed to get pixel color for sprite picking on entity 454v1: OutOfBounds { x: 400, y: 295, z: 0 }. This is probably caused by the use of a compressed texture format. Consider using `SpritePickingMode::BoundingBox`.
im gonna only warn on the specific error used when its because of compressed assets

@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Picking Pointing at and selecting objects of all sorts S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 7, 2026
@alice-i-cecile
Copy link
Member

Ping me when this is ready for review and I'll take a look :)

@mirsella mirsella force-pushed the sprite-picking-warn branch from 933c5ea to 5e0f22e Compare January 7, 2026 20:01
@mirsella mirsella marked this pull request as ready for review January 7, 2026 20:01
@mirsella
Copy link
Contributor Author

mirsella commented Jan 7, 2026

@alice-i-cecile ready, this is much better now :)

@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-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jan 7, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 7, 2026
Merged via the queue into bevyengine:main with commit 4235b41 Jan 7, 2026
43 of 44 checks passed
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 C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sprite picking silently fail on compressed assets formats

3 participants