Link to Main schedule docs from other schedules (#10691)

I incorrectly assumed that moving a system from `Update` to
`FixedUpdate` would simplify logic without hurting performance.

But this is not the case: if there's single-threaded long computation in
the `FixedUpdate`, the machine won't do anything else in parallel with
it. Which might be not what users expect.

So this PR adds a note. But maybe it is obvious, I don't know.
This commit is contained in:
Stepan Koltsov 2023-11-22 20:50:37 +00:00 committed by GitHub
parent b0cc6bfd7e
commit 85b6326970
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,22 +27,26 @@ use bevy_ecs::{
pub struct Main; pub struct Main;
/// The schedule that runs before [`Startup`]. /// The schedule that runs before [`Startup`].
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct PreStartup; pub struct PreStartup;
/// The schedule that runs once when the app starts. /// The schedule that runs once when the app starts.
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Startup; pub struct Startup;
/// The schedule that runs once after [`Startup`]. /// The schedule that runs once after [`Startup`].
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct PostStartup; pub struct PostStartup;
/// Runs first in the schedule. /// Runs first in the schedule.
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct First; pub struct First;
@ -53,17 +57,19 @@ pub struct First;
/// [`PreUpdate`] exists to do "engine/plugin preparation work" that ensures the APIs consumed in [`Update`] are "ready". /// [`PreUpdate`] exists to do "engine/plugin preparation work" that ensures the APIs consumed in [`Update`] are "ready".
/// [`PreUpdate`] abstracts out "pre work implementation details". /// [`PreUpdate`] abstracts out "pre work implementation details".
/// ///
/// This is run by the [`Main`] schedule. /// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct PreUpdate; pub struct PreUpdate;
/// Runs [state transitions](bevy_ecs::schedule::States). /// Runs [state transitions](bevy_ecs::schedule::States).
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct StateTransition; pub struct StateTransition;
/// Runs the [`FixedUpdate`] schedule in a loop according until all relevant elapsed time has been "consumed". /// Runs the [`FixedUpdate`] schedule in a loop according until all relevant elapsed time has been "consumed".
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct RunFixedUpdateLoop; pub struct RunFixedUpdateLoop;
@ -74,16 +80,20 @@ pub struct RunFixedUpdateLoop;
/// ///
/// Frequency of execution is configured by inserting `Time<Fixed>` resource, 64 Hz by default. /// Frequency of execution is configured by inserting `Time<Fixed>` resource, 64 Hz by default.
/// See [this example](https://github.com/bevyengine/bevy/blob/latest/examples/time/time.rs). /// See [this example](https://github.com/bevyengine/bevy/blob/latest/examples/time/time.rs).
///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct FixedUpdate; pub struct FixedUpdate;
/// The schedule that contains app logic. /// The schedule that contains app logic.
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Update; pub struct Update;
/// The schedule that contains scene spawning. /// The schedule that contains scene spawning.
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct SpawnScene; pub struct SpawnScene;
@ -94,12 +104,13 @@ pub struct SpawnScene;
/// [`PostUpdate`] exists to do "engine/plugin response work" to things that happened in [`Update`]. /// [`PostUpdate`] exists to do "engine/plugin response work" to things that happened in [`Update`].
/// [`PostUpdate`] abstracts out "implementation details" from users defining systems in [`Update`]. /// [`PostUpdate`] abstracts out "implementation details" from users defining systems in [`Update`].
/// ///
/// This is run by the [`Main`] schedule. /// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct PostUpdate; pub struct PostUpdate;
/// Runs last in the schedule. /// Runs last in the schedule.
/// This is run by the [`Main`] schedule. ///
/// See the [`Main`] schedule for some details about how schedules are run.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)] #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Last; pub struct Last;