Skip to content
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

Hierarchy #713

Merged
merged 3 commits into from
Oct 29, 2020
Merged

Hierarchy #713

merged 3 commits into from
Oct 29, 2020

Conversation

svents
Copy link
Contributor

@svents svents commented Oct 21, 2020

If you spawn an entity with a parent component, it takes two ticks right now for that entity to get added to the list of children of its new parent. In the first tick, missing_previous_parent_system adds a PreviousParent(None) to the entity, which will be added after parent_update_system has run. Since parent_update_system queries for entities with a previous parent, the child list of the new parent is not yet updated. In the second tick, parent_update_system picks the entity up and updates the child list of the parent.
This caused a panic for me when I tried to despawn the parent recursively one tick after the creation of its new child (parent_update_system then tries to insert a new child list for an entity that just got despawned). Merging the two systems fixes that and allows to get rid of the Optional in the PreviousParent struct.

@Moxinilian Moxinilian added A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible labels Oct 22, 2020
@cart
Copy link
Member

cart commented Oct 29, 2020

Very good call. This is definitely a welcome change.

@cart cart merged commit 7734b1e into bevyengine:master Oct 29, 2020
@svents svents deleted the hierarchy branch November 2, 2020 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants