From e164e5a873c78210aad176a885f852bcf113701f Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Sun, 4 Aug 2024 06:36:52 -0700 Subject: [PATCH] Add link to `with_children` in `with_child` doc (#14604) # Objective Discourage users from using `with_child` for spawning multiple children. ## Solution Add link to `with_children` in docs for `with_child`. --- crates/bevy_hierarchy/src/child_builder.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/bevy_hierarchy/src/child_builder.rs b/crates/bevy_hierarchy/src/child_builder.rs index 95298f0d71..6b949119cd 100644 --- a/crates/bevy_hierarchy/src/child_builder.rs +++ b/crates/bevy_hierarchy/src/child_builder.rs @@ -339,9 +339,17 @@ pub trait BuildChildren { type Builder<'a>: ChildBuild; /// Takes a closure which builds children for this entity using [`ChildBuild`]. + /// + /// For convenient spawning of a single child, you can use [`with_child`]. + /// + /// [`with_child`]: BuildChildren::with_child fn with_children(&mut self, f: impl FnOnce(&mut Self::Builder<'_>)) -> &mut Self; /// Spawns the passed bundle and adds it to this entity as a child. + /// + /// For efficient spawning of multiple children, use [`with_children`]. + /// + /// [`with_children`]: BuildChildren::with_children fn with_child(&mut self, bundle: B) -> &mut Self; /// Pushes children to the back of the builder's children. For any entities that are