#dyn #bevy #gamedev

bevy_dynamic_bundle

Provides dynamic bundles for bevy

3 unstable releases

0.2.1 Jun 9, 2024
0.2.0 Jun 9, 2024
0.1.0 Jun 8, 2024

#833 in Game dev

Download history 98/week @ 2024-06-02 276/week @ 2024-06-09 9/week @ 2024-06-16 7/week @ 2024-06-30 16/week @ 2024-07-07 33/week @ 2024-07-28 1/week @ 2024-08-04

55 downloads per month

Custom license

31KB
115 lines

bevy_dynamic_bundle

A simple library for providing dynamic bundles to bevy

use DynamicBundel::new() to create a dynamic bundle that can be used by dyn_spawn or dyn_insert.

Heres some example code:

use bevy_dynamic_bundle::prelude::*;
use bevy::prelude::*;

#[derive(Component, Clone)]
struct ComponentA(i32);

fn main() {
    App::new().add_systems(Startup, (setup, query).chain()).run();
}

fn setup(mut commands: Commands) {
    let dyn_bundle = DynamicBundel::new(ComponentA(2));

    commands.dyn_spawn(dyn_bundle);

            
}

fn query(components: Query<&ComponentA>) {
    assert_eq!(2 ,components.get_single().unwrap().0);
}

Dependencies

~19–46MB
~742K SLoC