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

EntityManager.SetParent

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 SetParent(Entity child, Entity newParent, bool preserveWorldTransform);

Parameters

Parameter Description
child The entity whose parent should be changed.
newParent The new parent entity for child. If this value is Entity.Null, child will have no parent and will become the root of a new hierarchy.
preserveWorldTransform If true, the world-space transform of child will be preserved as closely as possible by setting its Unity.Transforms.LocalTransform component to match its current world-space transform. Slight differences are still possible due to floating-point rounding.

If false, child's Unity.Transforms.LocalTransform components will not be modified. However, the existing value will now be relative to world-space instead to its previous parent; this may cause a significant instantaneous change in its world-space transform.

Description

Establish a new link between a child and parent entity.

This function must not be used from an ExclusiveEntityTransaction context. Manipulating transform hierarchies from worker threads is not safe.