-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
Problem
Given a &World, I cannot issue a query that only reads from the world.
There are two possible methods on World for this: query, query_filtered, plus SystemState::new(). All of them require &mut World, as they could provide mutating type parameters.
Proposed Solutions
Quick-and-dirty
Make read-only variants of all three methods.
Ergonomic
Add a system_state and read_only_system_state method to World, which generates a SystemState and then immediately calls .get_mut / .get on it.
This allows users to do things like:
let query = world.read_only_system_state::<Query<(&Foo, &Bar), With<Bat>>>();
for (foo, bar) in query.iter(){
}nkzawa, hikikones, ethereumdegen, rotoclone, bennobuilder and 7 more
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!