Trait bevy_hierarchy::BuildWorldChildren
source · pub trait BuildWorldChildren {
// Required methods
fn with_children(
&mut self,
spawn_children: impl FnOnce(&mut WorldChildBuilder<'_>)
) -> &mut Self;
fn add_child(&mut self, child: Entity) -> &mut Self;
fn push_children(&mut self, children: &[Entity]) -> &mut Self;
fn insert_children(
&mut self,
index: usize,
children: &[Entity]
) -> &mut Self;
fn remove_children(&mut self, children: &[Entity]) -> &mut Self;
fn set_parent(&mut self, parent: Entity) -> &mut Self;
fn remove_parent(&mut self) -> &mut Self;
}
Expand description
Trait that defines adding children to an entity directly through the World
Required Methods§
sourcefn with_children(
&mut self,
spawn_children: impl FnOnce(&mut WorldChildBuilder<'_>)
) -> &mut Self
fn with_children( &mut self, spawn_children: impl FnOnce(&mut WorldChildBuilder<'_>) ) -> &mut Self
Creates a WorldChildBuilder
with the given children built in the given closure
sourcefn push_children(&mut self, children: &[Entity]) -> &mut Self
fn push_children(&mut self, children: &[Entity]) -> &mut Self
Pushes children to the back of the builder’s children
sourcefn insert_children(&mut self, index: usize, children: &[Entity]) -> &mut Self
fn insert_children(&mut self, index: usize, children: &[Entity]) -> &mut Self
Inserts children at the given index
sourcefn remove_children(&mut self, children: &[Entity]) -> &mut Self
fn remove_children(&mut self, children: &[Entity]) -> &mut Self
Removes the given children
sourcefn set_parent(&mut self, parent: Entity) -> &mut Self
fn set_parent(&mut self, parent: Entity) -> &mut Self
Set the parent
of this entity. This entity will be added to the end of the parent
’s list of children.
If this entity already had a parent it will be removed from it.
sourcefn remove_parent(&mut self) -> &mut Self
fn remove_parent(&mut self) -> &mut Self
Remove the parent from this entity.