Do a Query without having it as a system parameter #18078
-
I want make an utility function that acts as a getter for some component value from an entity. That component is deeply nested (parent/children relationship) and i don't want the user to know anything about the structure of these relationships (that's why i'm encapsulating this getter logic into a helper function). Can i make Queries sort of dynamically, without requiring the user of the getter to define the necessary queries as parameters on their systems and then pass them to the getter? E.g. can i do it given a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Bevy needs to know what data a system may access so that it knows which systems can run in parallel. So you can't do that unless you give the system access to all data (by using |
Beta Was this translation helpful? Give feedback.
Bevy needs to know what data a system may access so that it knows which systems can run in parallel. So you can't do that unless you give the system access to all data (by using
&mut World
as a system param). The reason that you can queue commands that access any data is that commands are run later when they have exclusive access to the world.