mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-26 17:44:11 +00:00
better example
This commit is contained in:
parent
4d9c451de8
commit
3e14cc06bf
@ -1,7 +1,7 @@
|
||||
use bevy::prelude::*;
|
||||
use blenvy::{BlenvyPlugin, BlueprintInfo, GameWorldTag, HideUntilReady, SpawnBlueprint};
|
||||
|
||||
#[derive(Component, Reflect)]
|
||||
#[derive(Component, Reflect, Debug)]
|
||||
#[reflect(Component)]
|
||||
pub struct TupleRelations(Entity); // TODO: Serialization on blender side currently is broken
|
||||
|
||||
@ -21,6 +21,7 @@ fn main() {
|
||||
.register_type::<TupleRelations>()
|
||||
.register_type::<BigRelations>()
|
||||
.add_systems(Startup, setup_game)
|
||||
.add_systems(Update, (print_names, print_tuple_relations))
|
||||
.run();
|
||||
}
|
||||
|
||||
@ -33,3 +34,15 @@ fn setup_game(mut commands: Commands) {
|
||||
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