Use component lifecycle hooks to make Parent
+ Children
hierarchy code simpler and more robust
#12235
Labels
A-ECS
Entities, components, systems, and events
A-Hierarchy
Parent-child entity hierarchies
C-Code-Quality
A section of code that is hard to understand or change
D-Complex
Quite challenging from either a design or technical perspective. Ask for help!
Milestone
What problem does this solve or what need does it fill?
bevy_hierarchy
's internals are complex, performance-critical, and have panicking unsafe code in them.The core reason for this is that we cannot let the graph become invalid: this leads to wasted work, subtle bugs and huge amounts of user frustration. And because we use
unsafe
code internally that relies on the assumption of validity for soundness, this can become a soundness problem.They're painful to maintain, and nearly impossible to replicate externally for other hierarchy-like code that wants to uphold these same variants.
What solution would you like?
#10756 adds component lifecycle hooks: operations that take effect when components are added or removed.
We should replace the existing complex code in
bevy_hierarchy
with this idiom, being sure to benchmark and optimize performance.What alternative(s) have you considered?
We could wait until the fabled day that relations (#3742) finally gets shipped.
Additional context
This has been widely anticipated as one of the key benefits of that PR: I'm recording it here to make sure we don't forget (and can coordinate work).
While the user-facing API is also pretty gnarly and inconsistent, I'd like to leave that for future work to make sure that the correctness-sensitive internals get the review attention it needs.
The text was updated successfully, but these errors were encountered: