macro_rules! related {
($relationship_target:ty [$($child:expr),*$(,)?]) => { ... };
}
Expand description
Returns a SpawnRelatedBundle
that will insert the given RelationshipTarget
, spawn a SpawnableList
of entities with given bundles that
relate to the RelationshipTarget
entity via the RelationshipTarget::Relationship
component, and reserve space in the RelationshipTarget
for each spawned entity.
The first argument is the RelationshipTarget
type. Any additional arguments will be interpreted as bundles to be spawned.
Also see children
for a Children
-specific equivalent.
let mut world = World::new();
world.spawn((
Name::new("Root"),
related!(Children[
Name::new("Child1"),
(
Name::new("Child2"),
related!(Children[
Name::new("Grandchild"),
])
)
])
));