Skip to content

Simple methods to list all components and all resources #3007

Open
@alice-i-cecile

Description

@alice-i-cecile

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

Having a list of all resources or all components is useful for debugging purposes.
This will be particularly valuable in the editor.

What solution would you like?

~~Add a Resources system parameter.

On both the Components and Resources system parameter, implement Iter, returning ComponentInfo as the item.~~

EDIT: this has been fixed for resources by #12829, but an equivalent for components is still missing.

What alternative(s) have you considered?

Right now, you can use the complex method listed in https://bevy-cheatbook.github.io/cookbook/print-resources.html for resources, but no such obvious method exists for components.

Blindly check component IDs from Components by trying all of the usize options (or hoping they're strictly contiguous and start at 0).

World::inspect_entity can be used to inspect all of the components of a specific entity, and was added in #5136.

Additional context

#15435 improves this situation for query errors and could be helpful inspiration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-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