-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Move scene spawner systems to SpawnScene schedule #9260
Conversation
Please, fill the migration guide and changelog properly. |
Done. |
Migration guide describes what users need to do in order to migrate. So you need to ask users to remove |
Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
crates/bevy_scene/src/lib.rs
Outdated
.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()); |
There was a problem hiding this comment.
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
?..
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looking to ensure that the system runs before the propagation systems, otherwise LGTM.
Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
crates/bevy_scene/src/lib.rs
Outdated
.add_systems(Update, scene_spawner_system) | ||
// Systems `*_bundle_spawner` must run before `scene_spawner_system` | ||
.add_systems(PreUpdate, scene_spawner); | ||
.add_systems(PreUpdate, (scene_spawner, scene_spawner_system).chain()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.add_systems(PreUpdate, (scene_spawner, scene_spawner_system).chain()); | |
.add_systems(PostUpdate, (scene_spawner, scene_spawner_system).chain().before(propagate_transform)); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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)
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judging by the messages in the discord, option 3 from #9260 (comment) is the most reasonable choice. Please add a new schedule and put these systems here.
Agreed! |
Scene spawning will happen after `Update`, so two updates will be needed anyway, see bevyengine/bevy#9260
# Objective - Fixes bevyengine#9250 ## Changelog - Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate][Update][SpawnScene][PostUpdate]) ## Migration Guide - Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate][Update][SpawnScene][PostUpdate]), you might remove system ordering code related to scene spawning as the execution order has been guaranteed by bevy engine. --------- Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
# Objective - Fixes bevyengine#9250 ## Changelog - Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate][Update][SpawnScene][PostUpdate]) ## Migration Guide - Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate][Update][SpawnScene][PostUpdate]), you might remove system ordering code related to scene spawning as the execution order has been guaranteed by bevy engine. --------- Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
# Objective #9260 added this schedule, but it's not in prelude like other schedules. ## Solution Add to prelude.
Objective
scene_spawner_system
toPostUpdate
. #9250Changelog
Migration Guide