Mutable query
This commit is contained in:
parent
932866a943
commit
74502b368c
12
src/main.rs
12
src/main.rs
@ -24,9 +24,19 @@ fn greet_people(query: Query<&Name, With<Person>>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn update_people(mut query: Query<&mut Name, With<Person>>) {
|
||||||
|
|
||||||
|
for mut name in &mut query {
|
||||||
|
if name.0 == "Orlando Tampa" {
|
||||||
|
name.0 = "Carlos Satanick".to_string();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_systems(Startup, add_people)
|
.add_systems(Startup, add_people)
|
||||||
.add_systems(Update, (gamarjoba, greet_people))
|
.add_systems(Update, (gamarjoba, (update_people, greet_people).chain()))
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user