Skip to content

Many-to-Many Relationships #18657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

ItsDoot
Copy link
Contributor

@ItsDoot ItsDoot commented Apr 1, 2025

Objective

Solution

  • Relationships now have their own RelationshipCollection as well (previously named RelationshipSourceCollection).

Testing

Added additional unit tests.


Showcase

Many-to-many relationships are now supported:

#[derive(Component, PartialEq, Debug)]
#[relationship(relationship_target = LikedBy)]
struct Likes(pub Vec<Entity>);

#[derive(Component)]
#[relationship_target(relationship = Likes)]
struct LikedBy(Vec<Entity>);

@ItsDoot ItsDoot marked this pull request as draft April 1, 2025 08:02
@ItsDoot ItsDoot changed the title Many-to- Many-to-Many Relationships Apr 1, 2025
@ItsDoot ItsDoot added this to the 0.17 milestone Apr 1, 2025
@ItsDoot ItsDoot added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide labels Apr 1, 2025
Copy link
Contributor

github-actions bot commented Apr 1, 2025

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-18657

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-18657

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-18657

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

@homebrewmellow
Copy link

I'm praying for you brother

@hukasu
Copy link
Contributor

hukasu commented Apr 15, 2025

do you have an example of how insertion and deletions will work?
insertion and deletion of items on the Vecs, not the Component

@atlv24 atlv24 modified the milestones: 0.17, 0.18 Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Complex Quite challenging from either a design or technical perspective. Ask for help! M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Many-to-Many relationships
4 participants