Skip to content

Automatically label systems with their TypeId #4219

Closed

Description

@alice-i-cecile

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

In many simple system ordering use cases, users are forced to define simple labels for each system they want to order, creating tedious and duplicative boilerplate, and encouraging the use of stringly-typed system labels.

This is particularly true in applications, rather than plugin libraries, where exposing a clean forwards-compatible public API is of much lower concern.

What solution would you like?

app.add_system(gravity).add_system(kinematics.after(gravity))

Automatically give each system a SystemLabel corresponding to their TypeId.

Change the signature of .before and .after to accept a impl IntoSystemLabel argument, and then convert provided system-like functions into the corresponding TypeId, which is then used in schedule graph construction.

What alternative(s) have you considered?

We could use the type_name instead of the TypeId to define the label. The pros and cons aren't fully clear to me, but the type_name docs state that it should really only be used for diagnostic purposes.

IMO we should remove string system labels as part of this change: the "quick-and-dirty" approach is already covered well by this design.

Additional context

I think it would be interesting to consider "automatically labeling" systems with either their type_name or their TypeId

Activity

  1. added
    A-ECSEntities, components, systems, and events
    C-UsabilityA targeted quality-of-life change that makes Bevy easier to use
    on Mar 15, 2022
  2. added a commit that references this issue on Mar 23, 2022
    b1c3e98
  3. added a commit that references this issue on Jun 7, 2022
    6b6d631
  4. added a commit that references this issue on Feb 1, 2023
    bb7f20c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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