Description
What problem does this solve or what need does it fill?
When inspecting entities for debugging or as part of an editor, it can often be challenging to quickly get a a sense of what "kind" of entity it is.
Right now, you can either inspect it visually, or pore through its (long) list of components. This will become unwieldy when we need things like tooltip displays.
What solution would you like?
Create "entity labels", which are many-to-many and use the same type magic as e.g. system and stage labels.
These can be added to the AppBuilder with the label_entities(bundle: impl Bundle)
.
Each entity will have a "labels" field, which will show all relevant labels in alphabetical order (there should only be one in most cases). A label is relevant to an entity if it has all of the components in that bundle.
These will be almost entirely for display purposes. Under the hood, this can be computed and stored on a per archetype level.
Depending on their cost, we may want to only enable these during debug builds.
What alternative(s) have you considered?
Somehow designate a specific component as being "defining", or specify a priority of these.
Additional context
These will be used in close association with archetype invariants (#1481). We should ensure that the syntax and location of these are closely tied.
These bundles will commonly be reused for kinded entities; it may be correct to allow syntactic sugar to allow their specification via these entity labels.
In theory we could use query filters to search for these entities. I'm not entirely convinced by this plan, but it's not the worst idea.