Entity disabling/enabling components should be recursive
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Currently all entity disabling/enabling components only disable/enable the entity that they are on, but do not touch related entities, unlike their despawning counterparts.
This is due to the discrepancy between recursively despawning and inserting/removing components.
https://github.com/bevyengine/bevy/blob/50242076bff304acb00a8fad5e7c7e6339100ba1/crates/bevy_ecs/src/system/commands/mod.rs#L1882
https://github.com/bevyengine/bevy/blob/50242076bff304acb00a8fad5e7c7e6339100ba1/crates/bevy_ecs/src/relationship/related_methods.rs#L327
## What solution would you like?
For now make them disable/enable children along `ChildOf`/`Children` as they'll be the most common relationship types.
If a method is found to bring insert/remove components recursively up to parity with despawning we should use it for the entity disabling/enabling components.
## What alternative(s) have you considered?
Add `PartialEq` to the entity disabling/enabling components and encourage user to use `Propagate` for whatever relationships they need
Contributor guide
Research direction
Start by reading the recursive despawning logic in crates/bevy_ecs/src/system/commands/mod.rs around line 1882 and the relationship handling in crates/bevy_ecs/src/relationship/related_methods.rs around line 327. Trace the entity disabling and enabling components, then make their behavior cover children through ChildOf/Children and verify that child entities follow the parent state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100