Skip to content

Storage type lookup utility function from World #2117

Closed
@alice-i-cecile

Description

@alice-i-cecile

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

While trying to write a new Query parameter, I need to figure out which storage type a specific component has.

I can only search over the tables field of my Storages, rather than being able to check directly.

This is frustratingly indirect and will result in subtle bugs if and when we add more storage types.

What solution would you like?

Create a lookup(ComponentId) -> StorageType method on Storages.

What alternative(s) have you considered?

I would prefer to just be able to pass in the type directly, but that's not possible :(

Additional context

Discovered during #2116.

When adding this functionality, we should check all other code accessing Storages to see if it applies to future-proof our work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions