4 releases
0.3.0 | Nov 30, 2024 |
---|---|
0.1.2 | Jul 15, 2024 |
0.1.1 | May 18, 2024 |
0.1.0 | May 18, 2024 |
#1342 in Game dev
141 downloads per month
510KB
95 lines
bevy_bundletree
Spawn trees of bundles in Bevy to make UI Code more ergonomic.
Usage
Define an enum to represent all possible bundles in your tree and derive IntoBundleTree
and BundleEnum
.
use bevy::prelude::*;
use bevy_bundletree::*;
#[derive(IntoBundleTree, BundleEnum)]
enum UiNode {
Node(NodeBundle),
Text(TextBundle),
Button(ButtonBundle),
}
fn setup(mut commands: Commands) {
let tree: BundleTree<UiNode> = NodeBundle::default().with_children([
TextBundle::default().into_tree(),
ButtonBundle::default().into_tree()]);
commands.spawn_tree(tree);
}
Bevy support table
bevy | bevy_bundletree |
---|---|
0.15 | 0.3.0 |
0.14 | 0.2.1 |
0.13 | 0.1.1 |
Dependencies
~21–58MB
~1M SLoC