Bevy lets you use ScreenshotManager even if it won't work
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
0.12.1
## Relevant system information
If you cannot get Bevy to build or run on your machine, please include:
- the Rust version you're using (you can get this by running `cargo --version`)
- cargo 1.75.0 (1d8b05cdd 2023-11-20)
- the operating system or browser used, including its version
- MacOS 14.2.1 (M1 ARM)
## What you did
The docs for `take_screenshot` say this:
> The given callback will eventually be called on one of the AsyncComputeTaskPool threads.
When I call `take_screenshot` it returns happily but the callback is never called. Same issue with `save_screenshot_to_disk`.
I'm setting up my systems with `DefaultPlugins.build().disable::()`. I'm guessing that whatever is meant to come along later and make the screenshot happen never happens because I don't have a window.
## What went wrong
While this is related to taking a screenshot in headless mode (https://github.com/bevyengine/bevy/pull/7163, https://github.com/bevyengine/bevy/issues/22), my main concern is with the API. If it's true that `take_screenshot` will never work without a window, one of the following should be true:
- Calling `screenshot_manager.take_screenshot` should return an error immediately indicating that screenshots aren't possible bc x y z other plugins are missing.
- It is impossible to get `mut screenshot_manager: ResMut` in the first place, I suppose bc the plugin is removed from the default set automatically if there is now window. Or maybe just because there is no event loop.
## Additional information
I understand that without WinitPlugin there is no event loop and the update only runs once, so I wonder if there is a way to force the callback to be called later. It seems that just dropping the `App` instance doesn't make it happen. I guess it depends on whether taking a screenshot is expected to work without a window or not, and therefore if it relates to the window or the event loop.
Contributor guide
Assessment
This issue has not been assessed yet.