Function bevy_ecs::schedule::common_conditions::not

source ·
pub fn not<Marker, TOut, T>(condition: T) -> NotSystem<T::System>
where TOut: Not, T: IntoSystem<(), TOut, Marker>,
Expand description

Generates a Condition that inverses the result of passed one.

§Example

app.add_systems(
    // `not` will inverse any condition you pass in.
    // Since the condition we choose always returns true
    // this system will never run
    my_system.run_if(not(always)),
);

fn my_system(mut counter: ResMut<Counter>) {
    counter.0 += 1;
}

fn always() -> bool {
    true
}

app.run(&mut world);
assert_eq!(world.resource::<Counter>().0, 0);