New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bevy lets you use ScreenshotManager even if it won't work #11493
Comments
Yeah, we could do better here. I think that either of your suggestions could be made to work. The second seems like it would be a bit involved. Another option might be to add a warning around here: bevy/crates/bevy_render/src/view/window/mod.rs Lines 189 to 191 in 4695b82
Out of curiosity, what are you using as #22 is still open for a reason. Totally headless screenshots aren't possible yet. Even Bevy's CI uses a slightly janky setup of using a virtual framebuffer, initiating a screenshot, and just waiting a few seconds and hoping it was saved to the disk in time before exiting. I don't believe there are any technical blockers. Just need a motivated person to make it work. There are a few third party crates that also deal with screenshotting and one or more of them may be able to do this. I haven't looked in a while. |
I'm using
Yeah for sure that's cool, I'm trying to do something similar for now too, or just run the API with access to a windowing system. |
Ah, right. Thanks. |
Bevy version
0.12.1
Relevant system information
If you cannot get Bevy to build or run on your machine, please include:
cargo --version
)What you did
The docs for
take_screenshot
say this:When I call
take_screenshot
it returns happily but the callback is never called. Same issue withsave_screenshot_to_disk
.I'm setting up my systems with
DefaultPlugins.build().disable::<WinitPlugin>()
. 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 (#7163, #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:screenshot_manager.take_screenshot
should return an error immediately indicating that screenshots aren't possible bc x y z other plugins are missing.mut screenshot_manager: ResMut<ScreenshotManager>
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.The text was updated successfully, but these errors were encountered: