Skip to content

Relational Queries #23018

@alice-i-cecile

Description

@alice-i-cecile

Goal Description

Accessing related entities (parents, children, ancestors) is a common demand when writing more complex logic in the ECS (particularly when working with scenes or UI). Our existing solutions are insufficiently ergonomic and challenging to discover, and inadequately composable. Without the use of multiple queries, boilerplate logic or exclusive systems, users should be able to:

  • fetch the value of a given component on the entity's parent
  • fetch the value of a given component from the first encountered ancestor on an entity, if such an entity is found
  • fetch the entity ID of the first encountered sibling entity with the given component
  • find the first child or grand-child with the given component
  • check if the values of a given component on any of the (recursive) children have changed
  • perform all of these operations but using arbitrary tree-like relationships instead of Children/ChildOf

Relational queries which involve value-checking are out-of-scope: only existing query filters need to be supported.

Previously: #17647

Goal Status

This is a potential Bevy Project Goal. Its state on the Project Goals Board determines if it is Proposed, Postponed, Blocked (Approved), Inactive (Approved), Active (Approved), Completed, or Declined.

  • Staffing SMEs: Not yet staffed
  • Working Group Link: Working Group not yet formed
  • Design Documents: Design documents not yet written

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleC-GoalSomething big or high-value that the Bevy Organization wants to accomplish. FOR SME USE ONLY!S-Waiting-on-SMEThis is currently waiting for an SME to resolve something controversialX-Needs-SMEThis type of work requires an SME to approve it.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Postponed
    Status
    SME Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions