Skip to content

Replace Trigger's default bundle filtering behavior from an OR to an AND #15325

Open
@ItsDoot

Description

@ItsDoot

What problem does this solve or what need does it fill?

The fact that the B in Trigger<E, B: Bundle> currently means OR instead of AND is confusing enough that it even surprised a maintainer. Everywhere else in bevy, tuples (which bundles can be) mean AND, so we should change Trigger's default behavior.

What solution would you like?

The following code should work (but doesn't currently):

fn my_observer(trigger: Trigger<Foo, (A, B)>) {

}

// This *should not* trigger the above observer:
world.trigger(Foo, world.component::<A>());
// But *this* should:
world.trigger(Foo, (world.component::<A>(), world.component::<B>());

Additional context

Moment of confusion on discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorD-ComplexQuite challenging from either a design or technical perspective. Ask for help!

    Type

    No type

    Projects

    Status

    Observer overhaul

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions