transform: run transform systems at startup and move transform systems to POST_UPDATE

This commit is contained in:
Carter Anderson 2020-06-22 12:55:54 -07:00
parent 6cd5af6f74
commit f72c4beadf

View file

@ -3,7 +3,7 @@ pub mod float_ord;
pub mod time;
pub mod transform;
use bevy_app::{stage, AppBuilder, AppPlugin};
use bevy_app::{stage, startup_stage, AppBuilder, AppPlugin};
use bevy_transform::{
components::{
Children, LocalTransform, NonUniformScale, Rotation, Scale, Transform, Translation,
@ -20,8 +20,12 @@ pub struct CorePlugin;
impl AppPlugin for CorePlugin {
fn build(&self, app: &mut AppBuilder) {
// we also add a copy of transform systems to startup to ensure we begin with correct transform/parent state
for transform_system in transform_system_bundle::build(app.world_mut()).drain(..) {
app.add_system(transform_system);
app.add_startup_system_to_stage(startup_stage::POST_STARTUP, transform_system);
}
for transform_system in transform_system_bundle::build(app.world_mut()).drain(..) {
app.add_system_to_stage(stage::POST_UPDATE, transform_system);
}
app.init_resource::<Time>()