better example
This commit is contained in:
parent
4d9c451de8
commit
3e14cc06bf
|
@ -1,7 +1,7 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use blenvy::{BlenvyPlugin, BlueprintInfo, GameWorldTag, HideUntilReady, SpawnBlueprint};
|
use blenvy::{BlenvyPlugin, BlueprintInfo, GameWorldTag, HideUntilReady, SpawnBlueprint};
|
||||||
|
|
||||||
#[derive(Component, Reflect)]
|
#[derive(Component, Reflect, Debug)]
|
||||||
#[reflect(Component)]
|
#[reflect(Component)]
|
||||||
pub struct TupleRelations(Entity); // TODO: Serialization on blender side currently is broken
|
pub struct TupleRelations(Entity); // TODO: Serialization on blender side currently is broken
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ fn main() {
|
||||||
.register_type::<TupleRelations>()
|
.register_type::<TupleRelations>()
|
||||||
.register_type::<BigRelations>()
|
.register_type::<BigRelations>()
|
||||||
.add_systems(Startup, setup_game)
|
.add_systems(Startup, setup_game)
|
||||||
|
.add_systems(Update, (print_names, print_tuple_relations))
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,3 +34,15 @@ fn setup_game(mut commands: Commands) {
|
||||||
GameWorldTag,
|
GameWorldTag,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn print_names(query: Query<(Entity, &Name), Added<Name>>) {
|
||||||
|
for (entity, name) in &query {
|
||||||
|
info!("[EXAMPLE] {name} is {entity}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print_tuple_relations(query: Query<(&Name, &TupleRelations), Added<TupleRelations>>) {
|
||||||
|
for (name, r) in &query {
|
||||||
|
info!("[EXAMPLE] {name} has the relation {r:?}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue