Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

EntityManager.DetachChildren

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void DetachChildren(Entity parent, bool preserveWorldTransform);

Parameters

Parameter Description
parent The entity whose children should be detached.
preserveWorldTransform If true, the world-space transform of all child entities will be preserved as closely as possible to match its current world-space transform. Slight differences are still possible due to floating-point rounding.

If false, the childrens' transforms will not be modified. However, the existing values will now be relative to world-space instead of parent; this may cause a significant instantaneous change in their world-space transforms.

Description

Break the parent/child links between the target entity and all of its children. Each child entity becomes the root of a new hierarchy.

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.