bevy/examples/app
Kevin Reid 1dfe83bb8d
Fix headless_renderer example and mention Screenshot. (#19598)
## Objective

- Makes `headless_renderer` example work instead of exiting without
effect.
- Guides users who actually just need
[`Screenshot`](https://docs.rs/bevy/0.16.1/bevy/render/view/window/screenshot/struct.Screenshot.html)
to use that instead.

This PR was inspired by my own efforts to do headless rendering, in
which the complexity of the `headless_renderer` example was a
distraction, and this comment from
https://github.com/bevyengine/bevy/issues/12478#issuecomment-2094925039
:

> The example added in https://github.com/bevyengine/bevy/pull/13006
would benefit from this change: be sure to clean it up when tackling
this work :)

That “cleanup” was not done, and I thought to do it, but it seems to me
that using `Screenshot` (in its current form) in the example would not
be correct, because — if I understand correctly — the example is trying
to, potentially, capture many *consecutive* frames, whereas `Screenshot`
by itself gives no means to capture multiple frames without gaps or
duplicates. But perhaps I am wrong (the code is complex and not clearly
documented), or perhaps that feature isn’t worth preserving. In that
case, let me know and I will revise this PR.

## Solution

- Added `exit_condition: bevy:🪟:ExitCondition::DontExit`
- Added a link to `Screenshot` in the crate documentation.

## Testing

- Ran the example and confirmed that it now writes an image file and
then exits.
2025-06-12 20:06:08 +00:00
..
custom_loop.rs Renamed EventWriter::send methods to write. (#17977) 2025-02-23 21:18:52 +00:00
drag_and_drop.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
empty_defaults.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
empty.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
headless_renderer.rs Fix headless_renderer example and mention Screenshot. (#19598) 2025-06-12 20:06:08 +00:00
headless.rs Fix compile errors on headless example (#18497) 2025-03-23 21:24:20 +00:00
log_layers_ecs.rs Remove apostrophes in possessive its (#19244) 2025-05-26 19:53:14 +00:00
log_layers.rs feat(log): support customizing default log formatting (#17722) 2025-05-05 23:01:06 +00:00
logs.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
no_renderer.rs Add configuration for async pipeline creation on RenderPlugin (#11847) 2024-02-16 13:35:47 +00:00
plugin_group.rs Remove second generic from .add_before, .add_after (#14285) 2024-07-15 15:58:14 +00:00
plugin.rs Rename Timer::finished and Timer::paused to is_finished and is_paused (#19386) 2025-05-27 22:24:18 +00:00
return_after_run.rs Remove redundant imports (#12817) 2024-04-01 19:59:08 +00:00
thread_pool_resources.rs Break CorePlugin into TaskPoolPlugin, TypeRegistrationPlugin, FrameCountPlugin. (#7083) 2023-01-05 11:42:35 +00:00
without_winit.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00