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 2 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
4 changes: 2 additions & 2 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,8 @@ 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`
lewiszlw marked this conversation as resolved.
Show resolved Hide resolved
.add_systems(PreUpdate, scene_spawner);
.add_systems(PreUpdate, (scene_spawner, scene_spawner_system).chain());
lewiszlw marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.add_systems(PreUpdate, (scene_spawner, scene_spawner_system).chain());
.add_systems(PostUpdate, (scene_spawner, scene_spawner_system).chain().before(propagate_transform));

Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed it in Discord and decided that it's better to put it in PostUpdate to have fully updated transform.
@lewiszlw I really sorry you had to change it so many times 😄
But this one you can't apply from the browser, you need to import propagate_transform.

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries. Should be .before(TransformSystem::TransformPropagate)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, looks like this is what mostly used in the codebase.

Copy link
Contributor

Choose a reason for hiding this comment

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

Before you make any change, take a look at what cart suggesting, I think it makes sense: #9260 (comment)
Because both solution (PreUpdate and PostUpdate) have downsides, this is why we have such hard time deciding it.

}
}

Expand Down