mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-27 10:04:10 +00:00
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
Block a user