#bevy-ui #bevy #tree #bundles #enums #game-engine #bundletree

bevy_bundletree

Spawn trees of bundles in the Bevy game engine

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

Download history 6/week @ 2024-09-21 1/week @ 2024-09-28 1/week @ 2024-10-12 4/week @ 2024-11-02 139/week @ 2024-11-30

141 downloads per month

MIT/Apache

510KB
95 lines

bevy_bundletree

License Crates.io Docs

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