bevyengine / bevyengine/bevy

Consider making `remove_with_requires` automatic

Open
#20,753 2 comments 1 reaction 0 assignees View on GitHub
A-ECS C-Feature D-Modest
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?

In https://github.com/simgine/bevy_enhanced_input we need to tell our users to remove input contexts using `remove_with_requires` instead of just regular `remove` in order to do it properly. But this is quite error-prone.

## What solution would you like?

We previously had `despawn` and `despawn_recursive`. Later, we made `despawn` controlled by relations.
Maybe we could do the same for required components - using a special associated constant that specifies whether a required component needs to be removed upon removal.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing remove_with_requires behavior and the earlier change that made despawn controlled by relations. Compare those APIs and determine how a required component could declare removal behavior through an associated constant. Done means the automatic behavior and its API semantics are agreed and implemented without requiring users to choose remove_with_requires manually.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.