Update Component docs to point to Relationship trait (#18179)
also updates Relationship docs terminology # Objective - Contributes to #18111 ## Solution Updates Component docs with a new section linking to Relationship. Also updates some Relationship terminology as I understand it. ## Testing - Did you test these changes? If so, how? - opened Docs, verified link - Are there any parts that need more testing? - I don't think so - How can other people (reviewers) test your changes? Is there anything specific they need to know? - run `cargo doc --open` and check out Component and Relationship docs, verify their correctness - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? - I think this is n/a but I ran the doc command on Ubuntu 24.04.2 LTS --- ## Showcase  ## Migration Guide n/a
This commit is contained in:
parent
c6204279eb
commit
ab38b61001
@ -282,6 +282,23 @@ use thiserror::Error;
|
|||||||
/// Note that requirements must currently be registered before the requiring component is inserted
|
/// Note that requirements must currently be registered before the requiring component is inserted
|
||||||
/// into the world for the first time. Registering requirements after this will lead to a panic.
|
/// into the world for the first time. Registering requirements after this will lead to a panic.
|
||||||
///
|
///
|
||||||
|
/// # Relationships between Entities
|
||||||
|
///
|
||||||
|
/// Sometimes it is useful to define relationships between entities. A common example is the
|
||||||
|
/// parent / child relationship. Since Components are how data is stored for Entities, one might
|
||||||
|
/// naturally think to create a Component which has a field of type [`Entity`].
|
||||||
|
///
|
||||||
|
/// To facilitate this pattern, Bevy provides the [`Relationship`](`crate::relationship::Relationship`)
|
||||||
|
/// trait. You can derive the [`Relationship`](`crate::relationship::Relationship`) and
|
||||||
|
/// [`RelationshipTarget`](`crate::relationship::RelationshipTarget`) traits in addition to the
|
||||||
|
/// Component trait in order to implement data driven relationships between entities, see the trait
|
||||||
|
/// docs for more details.
|
||||||
|
///
|
||||||
|
/// In addition, Bevy provides canonical implementations of the parent / child relationship via the
|
||||||
|
/// [`ChildOf`](crate::hierarchy::ChildOf) [`Relationship`](crate::relationship::Relationship) and
|
||||||
|
/// the [`Children`](crate::hierarchy::Children)
|
||||||
|
/// [`RelationshipTarget`](crate::relationship::RelationshipTarget).
|
||||||
|
///
|
||||||
/// # Adding component's hooks
|
/// # Adding component's hooks
|
||||||
///
|
///
|
||||||
/// See [`ComponentHooks`] for a detailed explanation of component's hooks.
|
/// See [`ComponentHooks`] for a detailed explanation of component's hooks.
|
||||||
|
@ -50,7 +50,7 @@ use log::warn;
|
|||||||
/// #[relationship(relationship_target = Children)]
|
/// #[relationship(relationship_target = Children)]
|
||||||
/// pub struct ChildOf {
|
/// pub struct ChildOf {
|
||||||
/// #[relationship]
|
/// #[relationship]
|
||||||
/// pub child: Entity,
|
/// pub parent: Entity,
|
||||||
/// internal: u8,
|
/// internal: u8,
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user