bevy_dynamic_bundle

Crates.iobevy_dynamic_bundle
lib.rsbevy_dynamic_bundle
version0.2.1
sourcesrc
created_at2024-06-08 18:13:16.926923
updated_at2024-06-09 07:39:57.211232
descriptionProvides dynamic bundles for bevy
homepage
repositoryhttps://github.com/oskuhansson/bevy_dynamic_bundle
max_upload_size
id1265893
size117,303
(oskuhansson)

documentation

https://docs.rs/bevy_dynamic_bundle

README

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);
}
Commit count: 9

cargo fmt