Struct hecs_hierarchy::TreeBuilder
source ·
[−]pub struct TreeBuilder<'a, T> { /* private fields */ }
Expand description
A wrapper to help spawn trees more ergonomically
Example
struct TreeMarker;
let mut world = World::new();
let builder = TreeBuilder::<TreeMarker>::new(&mut world);
let tree_root = builder
.spawn_tree(("root",))
.attach_new(("child 1",))
.attach({
builder
.spawn_tree(("child 2",))
.attach_new(("child 2.1",))
.attach_new(("child 2.2",))
.entity()
})
.entity();
Implementations
Spawns an entity in the world wrapped in this TreeBuilder
, without
actually building a tree or attaching it to anything.
Spawns a tree root in the world wrapped in this TreeBuilder
, returning
a TreeBuilderAt
that allows spawning children under it.