0.17.3 Sprite picking behaves weird with more than one camera
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version and features
- 0.17.3
- `--features custom_cursor`
```
AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
```
## What I did
In my game, I:
1. had a custom cursor
2. used sprite picking (i.e. click observers on sprites)
3. had multiple cameras
Apparently, this deadly combo disables sprite picking, if the multiple cameras are spawned in certain order.
I made a demo to show it:
https://github.com/guysv/bevy/blob/e55d756b7c70fffa331f1f6fb97f51ae03d2788a/examples/window/custom_cursor_image.rs
run with
```
ENABLE_CUSTOM_CURSOR_AT_STARTUP=1 SPAWN_MINIMAP_CAMERA_AT_STARTUP=1 cargo run --example custom_cursor_image --features custom_cursor
```
(from this revision of my fork: `e55d756b7c70fffa331f1f6fb97f51ae03d2788a`)
the commit after it is coding agent proposed fix where I investigated the issue
## What went wrong
- if custom cursor is enabled and "minimap"(=second camera) is enabled, clicking on the sprite at the middle of the screen doesn't work until we disable the second camera ('C' key).
- if we respawn the second camera, sprite clicking is broken again
if either env vars in the command are missing, the example is working properly.
## Additional information
coding agent proposed fix
https://github.com/guysv/bevy/commit/5c36720bb9164c0b96ba13a5982745f4c71c07b7
I see bevy 0.18 rc already has a different implementation there. maybe they avoid the bug?
## WORKAROUND
to trick the find() call the fix removes, you can try to change the order you spawn cameras in your app. appears to make it work but it's undocumented so kinda scary.
Contributor guide
Assessment
This issue has not been assessed yet.