Create manual set_changed
and set_added
methods
#1718
Labels
A-ECS
Entities, components, systems, and events
C-Feature
A new feature, making something new possible
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
Existing solutions to manually toggle entities as changed or added are unclear and clunky workarounds.
You might want to do this if, for example, you need to re-process an entity as changed even though its data was not set directly.
What solution would you like?
Create either
commands.entity(e).set_changed()
orcommands.entity(e).set_changed(bool)
. Uses new syntax from #1703.Also create
set_added
andWorld
variants of the above.What alternative(s) have you considered?
For set_changed, you can manually deref_mut a component, but this is a bit more obscure and requires mutable access to the component.
For set_added, you can manually remove and re-add a component, but this is expensive, slow (WRT command processing) and obscure.
Additional context
Discussed in #1471 and #1711. The bool form of the new methods is more powerful, but also slightly more verbose, and might not have great use cases / present a footgun. I'm personally in favor of the bool method in order to provide more expressive power, but it would be good to have a more full discussion.
The text was updated successfully, but these errors were encountered: