Skip to content

Commit 631610c

Browse files
glocqGrégoire Locqueville
andauthored
Docs: Specify that Relationships may only be one-to-many or one-to-one (#23934)
This may be deduced by observing that the `Relationship` component only stores one entity ID, but in my opinion, to become aware of such a fundamental limitation, one should not need to look at the implementation and do some deducing. Tested by running `cargo doc --no-deps` from the root of the repository and opening the relevant webpage. Co-authored-by: Grégoire Locqueville <git@glocq.com>
1 parent 943d83c commit 631610c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • crates/bevy_ecs/src/relationship

crates/bevy_ecs/src/relationship/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ use log::warn;
2727

2828
/// A [`Component`] on a "source" [`Entity`] that references another target [`Entity`], creating a "relationship" between them. Every [`Relationship`]
2929
/// has a corresponding [`RelationshipTarget`] type (and vice-versa), which exists on the "target" entity of a relationship and contains the list of all
30-
/// "source" entities that relate to the given "target"
30+
/// "source" entities that relate to the given "target".
31+
///
32+
/// A [`Relationship`] may only be one-to-many (or one-to-one): an [`Entity`] may point to at most one [`Entity`] through the [`Relationship`] component.
3133
///
3234
/// The [`Relationship`] component is the "source of truth" and the [`RelationshipTarget`] component reflects that source of truth. When a [`Relationship`]
3335
/// component is inserted on an [`Entity`], the corresponding [`RelationshipTarget`] component is immediately inserted on the target component if it does

0 commit comments

Comments
 (0)