Add entity clone, component remove and reparent commands - #359
Merged
Conversation
waynemwashuma
force-pushed
the
reparent-commands
branch
from
August 18, 2026 03:29
8644c2e to
abbdeeb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Introduces additional high-level entity commands for cloning entities, removing components, and reparenting entities while preserving their world transforms.
Solution
The new operations are implemented as dedicated commands and queued through the existing
EntityCommandsAPI.Changes Made
EntityCommands.clone()creates a hierarchy-aware clone by traversing the source entity's descendants, cloning registered components and remapping entity relationships to the cloned hierarchy.EntityCommands.reparent()recalculates an entity's local transform relative to its new parent before changing theParentcomponent. It handles both 2D and 3D transforms and prevents an entity from being reparented to itself or one of its descendants..EntityCommands.remove()for removing a tuple of components from an entity.Why This Approach
TypeRegistrykeeps component cloning extensible and avoids requiring individual component types to be handled explicitly.Showcase
Before
Entities could be spawned and despawned through
EntityCommands, but there was no command-level API for cloning, removing components or reparenting.After
Entities can now be easily cloned, have components removed and be reparented:
Migration Guide
No migration required.
Checklist