Skip to content

Rename init_component and init_component_with_desciptor #15451

@alice-i-cecile

Description

@alice-i-cecile

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

App::init_component registers a component with the App's main world, configuring its ComponentDescriptor. It should almost never be called by end users as they're called internally when setting up queries.

App::init_resource initializes a resource with default values in the world, and is a common API.

This false parallel is confusing!

What solution would you like?

Rename init_component and init_component_with_desciptor to be called register_*, wherever they are defined (both App and World have methods at least).

Consider improving the docs for these methods while you're there, but you don't have to.

What alternative(s) have you considered?

We could call these initalize_component, but that's still unclear and confusing. We could instead call these get_component_id, but that's also a bit misleading: these methods do actually initialize things and need to be called even if the result is discarded.

Additional context

#15448 recommends adding another parallel method for resources. This should be renamed as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-TrivialNice and easy! A great choice to get started with BevyS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions