Added docs about MinimalPlugins looping as fast as possible. (#17241)
This also includes suggestions and an example on how to limit the loop speed. Fixes #17147. --------- Co-authored-by: François Mockers <francois.mockers@vleue.com>
This commit is contained in:
parent
00e82496d4
commit
3ce8b284d5
@ -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();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user