`RelationshipInsertHookMode` for `remove` and `take`
- 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?
While working on #18058, I realized I could further optimize the code if could stop relationship components from removing the relation ship target component when it's empty. Otherwise removing relationship components may lead to archetype moves which get undone when `replace_related` finishes
## What solution would you like?
- Rename `RelationshipInsertHookMode` to `RelationShipHookMode`
- Add `remove_with_relationship_insert_hook_mode` and `take_with_relationship_insert_hook_mode` analogous to `insert_with_relationship_insert_hook_mode` but for single components.
## What alternative(s) have you considered?
Just paying for the archetype moves. The performance hit probably isn't going to be too noticeable.
Contributor guide
Research direction
Locate `RelationshipInsertHookMode` and `insert_with_relationship_insert_hook_mode` in the Bevy source, then inspect the relationship removal and take paths they should parallel. Rename the mode and add the requested single-component operations; done means both methods follow the existing insert-hook behavior and the affected tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100