Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple Disabled marker #17514

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NiseVoid
Copy link
Contributor

@NiseVoid NiseVoid commented Jan 23, 2025

Objective

We have default query filters now, but there is no first-party marker for entity disabling yet
Fixes #17458

Solution

Add the marker, cool recursive features and/or potential hook changes should be follow up work

Testing

Added a unit test to check that the new marker is enabled by default

@NiseVoid NiseVoid added the A-ECS Entities, components, systems, and events label Jan 23, 2025
@BenjaminBrienen BenjaminBrienen added C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 23, 2025
@BenjaminBrienen
Copy link
Contributor

I think that this should close that issue. Would you mind fixing the description? :)

crates/bevy_ecs/src/entity_disabling.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/world/mod.rs Outdated Show resolved Hide resolved
crates/bevy_scene/src/scene.rs Outdated Show resolved Hide resolved
crates/bevy_scene/src/scene_filter.rs Outdated Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added this to the 0.16 milestone Jan 24, 2025

let disabled = self.register_component::<Disabled>();
let mut filters = DefaultQueryFilters::default();
filters.set_disabled(disabled);
Copy link
Contributor

@cBournhonesque cBournhonesque Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried that users might do a
app.init_resource::<DefaultQueryFilters>()

and lose the Disabled functionality inadvertently..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init_resource doesn't overwrite existing resources. You'd have to explicitly call .insert_resource(DefaultQueryFilters::default()) which is probably verbose enough to make it obvious what will happen. Currently it is intended that you can opt-out of entity disabling, but as the feature matures we could consider making it so that it is always there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a first-party Disabled component
5 participants