-
-
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-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-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?
Sometimes it is desirable to remove not just a specific component, but also its required components: #15572 (comment).
What solution would you like?
Add an entity.remove_with_requires::<SomeComponent>() API that removes all required components brought in by SomeComponent (recursively).
What alternative(s) have you considered?
- This should not be the default behavior of
entity.remove::<SomeComponent>(), as in many cases this could remove components that are required by other components. If we want to go this route, we need to consider building some sort of reference counting system to track requires across components. But there are still problems there (ex: what if someone manually added a component ... how do we distinguish between overriding a required component value and inserting a new separate persistent component).
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!