How to make a query that only runs when the given component has been mutated #19497
-
From Bevy 0.1 introduction I learn that we could make a query only runs when the given component has been mutated with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
This is what If that does work (I’m pretty sure it should but I've never personally used it), you could wrap it into your own #[derive(QueryFilter)]
struct Mutated<T: Component> {
changed: Changed<T>,
not_added: Without<Added<T>>,
} |
Beta Was this translation helpful? Give feedback.
-
I think what's generally done now is something like fn system(things: Query<Ref<Thing>, Changed<Thing>>) {
for thing in things.iter().filter(|r| !r.is_added()) {
// ...
}
} Relevant issue: #15070 |
Beta Was this translation helpful? Give feedback.
I think what's generally done now is something like
Relevant issue: #15070