Skip to content

Add a query_read_only that can be accessed through &World #10898

@hymm

Description

@hymm

What problem does this solve or what need does it fill?

For something like a UI tree, it can be useful to pass around a &World to allow read only access to the world to populate the tree in multiple places. But currently you can't get a QueryState out of &World as it requires &mut World to initialize the components in the query.

What solution would you like?

Have a panicking query_read_only that can be used from &World.

A lot of the foundational work for this has been done in #9774 which adds a get_state to SystemParam, which allows building a QueryState from &World. So this should probably be built on top of that work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions