@@ -84,17 +84,17 @@ pub enum TransformSystem {
84
84
TransformPropagate ,
85
85
}
86
86
87
+ // A set for `propagate_transforms` to mark it as ambiguous with `sync_simple_transforms`.
88
+ // Used instead of the `SystemTypeSet` as that would not allow multiple instances of the system.
89
+ #[ derive( Debug , Hash , PartialEq , Eq , Clone , SystemSet ) ]
90
+ struct PropagateTransformsSet ;
91
+
87
92
/// The base plugin for handling [`Transform`] components
88
93
#[ derive( Default ) ]
89
94
pub struct TransformPlugin ;
90
95
91
96
impl Plugin for TransformPlugin {
92
97
fn build ( & self , app : & mut App ) {
93
- // A set for `propagate_transforms` to mark it as ambiguous with `sync_simple_transforms`.
94
- // Used instead of the `SystemTypeSet` as that would not allow multiple instances of the system.
95
- #[ derive( Debug , Hash , PartialEq , Eq , Clone , SystemSet ) ]
96
- struct PropagateTransformsSet ;
97
-
98
98
app. register_type :: < Transform > ( )
99
99
. register_type :: < GlobalTransform > ( )
100
100
. add_plugin ( ValidParentCheckPlugin :: < GlobalTransform > :: default ( ) )
@@ -105,21 +105,22 @@ impl Plugin for TransformPlugin {
105
105
schedule. configure_set (
106
106
TransformSystem :: TransformPropagate . in_base_set ( StartupSet :: PostStartup ) ,
107
107
) ;
108
+ propagate_in_schedule ( schedule) ;
108
109
} )
109
- // FIXME: https://github.com/bevyengine/bevy/issues/4381
110
- // These systems cannot access the same entities,
111
- // due to subtle query filtering that is not yet correctly computed in the ambiguity detector
112
- . add_startup_system (
113
- sync_simple_transforms
114
- . in_set ( TransformSystem :: TransformPropagate )
115
- . ambiguous_with ( PropagateTransformsSet ) ,
116
- )
117
- . add_startup_system ( propagate_transforms. in_set ( PropagateTransformsSet ) )
118
- . add_system (
119
- sync_simple_transforms
120
- . in_set ( TransformSystem :: TransformPropagate )
121
- . ambiguous_with ( PropagateTransformsSet ) ,
122
- )
123
- . add_system ( propagate_transforms. in_set ( PropagateTransformsSet ) ) ;
110
+ . edit_schedule ( CoreSchedule :: FixedUpdate , propagate_in_schedule)
111
+ . edit_schedule ( CoreSchedule :: Main , propagate_in_schedule) ;
124
112
}
125
113
}
114
+
115
+ fn propagate_in_schedule ( schedule : & mut Schedule ) {
116
+ // FIXME: https://github.com/bevyengine/bevy/issues/4381
117
+ // These systems cannot access the same entities,
118
+ // due to subtle query filtering that is not yet correctly computed in the ambiguity detector
119
+ schedule
120
+ . add_system (
121
+ sync_simple_transforms
122
+ . in_set ( TransformSystem :: TransformPropagate )
123
+ . ambiguous_with ( PropagateTransformsSet ) ,
124
+ )
125
+ . add_system ( propagate_transforms. in_set ( PropagateTransformsSet ) ) ;
126
+ }
0 commit comments