-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Despawned Node Entities are not removed from their parent Node's Children #352
Comments
Children
@karroffel or @cart This behavior is also leading to a crash if you later call
This happens due to this
Would you rather incorporate the crashing behavior for spurious children into this issue, or would you rather I create a separate issue for that? |
I think the problem is that this function doesn't check for and remove the root bevy/crates/bevy_transform/src/hierarchy/hierarchy.rs Lines 46 to 58 in db8ec7d
|
@CleanCut The |
@ncallaway I should have guessed that--otherwise it would be extremely inefficient to ever discover your own parent, which would make composing transformation matrices insanely expensive! I'll take a shot at making a pull request. |
I opened #386 with an attempted fix. |
An entity that is despawned doesn't appear to be removed from the
Children
component of their parent Node.I'm not sure this is a bug, but I could see it eventually effective performance for a long running game that both spawns and despawns a lot of entities within a parent and iterates over the Children object a lot.
I think this is related to #351.
Example Reproduction
Result
My expectation is that despawned children are eventually removed from the
Parent
component. I don't expect it to be immediatey, so I wouldn't be surprised to occasionally see3 children
in my Parent even if there's only 1 child still alive, but I do expect them to be removed eventually.The text was updated successfully, but these errors were encountered: