Skip to content

Commit ebdec5c

Browse files
Add dynamic reference methods
1 parent 91c48d1 commit ebdec5c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

crates/bevy_ecs/src/term_query/builder.rs

+11
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ impl<'w, Q: QueryTermGroup> QueryBuilder<'w, Q> {
5454
self
5555
}
5656

57+
pub fn ref_id(&mut self, id: ComponentId) -> &mut Self {
58+
self.terms.push(Term::Component(ComponentTerm::read_id(id)));
59+
self
60+
}
61+
62+
pub fn mut_id(&mut self, id: ComponentId) -> &mut Self {
63+
self.terms
64+
.push(Term::Component(ComponentTerm::write_id(id)));
65+
self
66+
}
67+
5768
pub fn set<T: Component>(&mut self) -> &mut Self {
5869
let id = self.world.init_component::<T>();
5970
self.set_id(id);

0 commit comments

Comments
 (0)