Skip to content

Commit

Permalink
Document that AppExit can be read by Bevy apps (bevyengine#4587)
Browse files Browse the repository at this point in the history
Explain it's safe to subscribe to this event to detect an exit before it happens. For instance, to clean-up and release system resources.
  • Loading branch information
dtaralla authored and ItsDoot committed Feb 1, 2023
1 parent 4d4923d commit b4a03ef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,11 @@ fn run_once(mut app: App) {
app.update();
}

/// An event that indicates the [`App`] should exit. This will fully exit the app process.
/// An event that indicates the [`App`] should exit. This will fully exit the app process at the
/// start of the next tick of the schedule.
///
/// You can also use this event to detect that an exit was requested. In order to receive it, systems
/// subscribing to this event should run after it was emitted and before the schedule of the same
/// frame is over.
#[derive(Debug, Clone, Default)]
pub struct AppExit;

0 comments on commit b4a03ef

Please sign in to comment.