Method DetachChildren
DetachChildren(EntityManager, Entity, bool)
Break the parent/child links between the target entity and all of its children. Each child entity becomes the root of a new hierarchy.
Declaration
public static void DetachChildren(this EntityManager em, Entity parent, bool preserveWorldTransform = true)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityManager | em | The EntityManager. |
| Entity | parent | The entity whose children should be detached. |
| bool | preserveWorldTransform | If true, the world-space transform of all child entities will be preserved as closely as possible by setting each entity's LocalTransform component to match its current world-space transform. Slight differences are still possible due to floating-point rounding. If false, the childrens' LocalTransform components will not be modified. However, the existing
values will now be relative to world-space instead of |
Remarks
This is effectively the same as calling SetParent(child, Entity.Null, preserveWorldTransform) on all of the target entity's children, but is potentially more efficient.
This function must not be used from an ExclusiveEntityTransaction context. Manipulating transform hierarchies from worker threads is not safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the target |
| InvalidOperationException | Thrown if |