Skip to content

Commit

Permalink
enable change detection for labels (#1155)
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf authored Dec 28, 2020
1 parent b94f266 commit adb249c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions crates/bevy_core/src/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ impl EntityLabels {

pub(crate) fn entity_labels_system(
mut entity_labels: ResMut<EntityLabels>,
// the system runs in an early stage and so can't use a Changed<Labels> filter
query: Query<(Entity, &Labels)>,
query: Query<(Entity, &Labels), Changed<Labels>>,
) {
let entity_labels = entity_labels.deref_mut();

Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub mod prelude {
pub use crate::{DefaultTaskPoolOptions, EntityLabels, Labels, Time, Timer};
}

use bevy_app::prelude::*;
use bevy_app::{prelude::*, startup_stage};

/// Adds core functionality to Apps.
#[derive(Default)]
Expand All @@ -40,6 +40,7 @@ impl Plugin for CorePlugin {
.register_type::<Range<f32>>()
.register_type::<Timer>()
.add_system_to_stage(stage::FIRST, time_system.system())
.add_system_to_stage(stage::PRE_UPDATE, entity_labels_system.system());
.add_startup_system_to_stage(startup_stage::POST_STARTUP, entity_labels_system.system())
.add_system_to_stage(stage::POST_UPDATE, entity_labels_system.system());
}
}

0 comments on commit adb249c

Please sign in to comment.