-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
What problem does this solve or what need does it fill?
Internal components like Observer require an Internal component with a default query filter. Default query filters can be ignored by mentioning the type in the query, like With<Internal> or Allows<Internal>. But when the filter is added by a required component, the user may not know to mention it!
let mut world = World::new();
let entity = world.spawn(Observer::new(|_: On<Insert>| {})).id();
// This seems like it should work, but does not
let mut query = world.query::<&Observer>();
assert!(query.query(&world).get(entity).is_err());
// This is the workaround, but is hard to discover
let mut query = world.query_filtered::<&Observer, Allow<Internal>>();
assert!(query.query(&world).get(entity).is_ok());What solution would you like?
When a query mentions a component that requires a component with a default query filter, that filter should be ignored.
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!