Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move scene spawner systems to SpawnScene schedule #9260

Merged
merged 6 commits into from
Aug 15, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions crates/bevy_scene/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod scene_spawner;
#[cfg(feature = "serialize")]
pub mod serde;

use bevy_ecs::schedule::IntoSystemConfigs;
pub use bundle::*;
pub use dynamic_scene::*;
pub use dynamic_scene_builder::*;
Expand Down Expand Up @@ -40,9 +41,7 @@ impl Plugin for ScenePlugin {
.add_asset::<Scene>()
.init_asset_loader::<SceneLoader>()
.init_resource::<SceneSpawner>()
.add_systems(Update, scene_spawner_system)
// Systems `*_bundle_spawner` must run before `scene_spawner_system`
.add_systems(PreUpdate, scene_spawner);
.add_systems(PostUpdate, (scene_spawner, scene_spawner_system).chain());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reviewers: If we run it in PostUpdate, should run it after propagate_transforms?..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it should run before propagate_transforms and require a command application between them as it would otherwise be improperly placed in the following tick.

Copy link
Contributor

@Shatur Shatur Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, I wanted to write "before".
But why do we need a command flush? Scenes spawned in exclusive system with all necessary parenting.

Copy link
Contributor

@Shatur Shatur Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@james7132 alternatively we could move it to PreUpdate as I suggested in the issue first. Currently we have scene_spawner_system in Update and I think it's not a good choice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, wasn't too familiar with the scene systems. Sounds good to me to have it just run before propagate_transforms in that case.

}
}

Expand Down