bevyengine / bevyengine/bevy

Make the `RelationshipTarget` component half of relationships optional

Open
#17,444 0 comments 1 reaction 0 assignees View on GitHub
A-ECS C-Performance C-Usability D-Modest S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

> Before the recent relations PR landed, the standard way to create custom relations was to only define a single component for them (analogous to Parent). Bevy 0.16's relationships need *two* components, one for each side of the relationship.
>
> We could also make the `RelationshipTarget` component optional (you don't always need to be able to search in the other direction).

_Originally posted by @alice-i-cecile in [#17412](https://github.com/bevyengine/bevy/issues/17412#issuecomment-2601057321)_

The primary motivation for this is performance: if you *know* that you're only ever traversing up the relationship we can save a lot of work when updating the relationship.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.