Skip to content

Commit

Permalink
Added docs about MinimalPlugins looping as fast as possible. (#17241)
Browse files Browse the repository at this point in the history
This also includes suggestions and an example on how to limit the loop
speed.
Fixes #17147.

---------

Co-authored-by: François Mockers <[email protected]>
  • Loading branch information
AlephCubed and mockersf authored Jan 9, 2025
1 parent 00e8249 commit 3ce8b28
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/bevy_internal/src/default_plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,17 @@ plugin_group! {
/// It includes a [schedule runner (`ScheduleRunnerPlugin`)](crate::app::ScheduleRunnerPlugin)
/// to provide functionality that would otherwise be driven by a windowed application's
/// *event loop* or *message loop*.
///
/// By default, this loop will run as fast as possible, which can result in high CPU usage.
/// You can add a delay using [`run_loop`](crate::app::ScheduleRunnerPlugin::run_loop),
/// or remove the loop using [`run_once`](crate::app::ScheduleRunnerPlugin::run_once).
/// # Example:
/// ```rust, no_run
/// # use std::time::Duration;
/// # use bevy_app::{App, PluginGroup, ScheduleRunnerPlugin};
/// # use bevy_internal::MinimalPlugins;
/// App::new().add_plugins(MinimalPlugins.set(ScheduleRunnerPlugin::run_loop(
/// // Run 60 times per second.
/// Duration::from_secs_f64(1.0 / 60.0),
/// ))).run();
}

0 comments on commit 3ce8b28

Please sign in to comment.