Closed darkautism closed 1 month ago
#[derive(TiledObject, Bundle, Default, Reflect, Debug)] struct PlayerBundle { p:Player, } #[derive(TiledClass, Reflect, Debug, Default, Component)] struct Player;
I register this type and I want create an system to spawn player when compoment spawn
.add_systems(Update, spawnplayer.run_if(any_with_component::<Player>))
Then the compiler was angry!
error[E0599]: the method `run_if` exists for fn item `fn(&mut Commands<'b, 'c>, Query<'d, 'e, &Transform, With<Player>>) {spawnplayer}`, but its trait bounds were not satisfied --> src/main.rs:21:42 | 21 | .add_systems(Update, spawnplayer.run_if(any_with_component::<Player>)) | ^^^^^^ method cannot be called due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: IntoSystem<(), (), _>` which is required by `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: bevy::prelude::IntoSystemConfigs<_>` `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: SystemSet` which is required by `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: bevy::prelude::IntoSystemSetConfigs` `&for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: IntoSystem<(), (), _>` which is required by `&for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: bevy::prelude::IntoSystemConfigs<_>` `&for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: SystemSet` which is required by `&for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: bevy::prelude::IntoSystemSetConfigs` `&mut for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: IntoSystem<(), (), _>` which is required by `&mut for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: bevy::prelude::IntoSystemConfigs<_>` `&mut for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: SystemSet` which is required by `&mut for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut bevy::prelude::Commands<'b, 'c>, bevy::prelude::Query<'d, 'e, &'f bevy::prelude::Transform, bevy::prelude::With<Player>>) {spawnplayer}: bevy::prelude::IntoSystemSetConfigs`
What can i do?
My fault, system param has some typo.
I register this type and I want create an system to spawn player when compoment spawn
Then the compiler was angry!
What can i do?