ドキュメント

Unity Engine

Unity Engine

DetachChildren()

Unparents all of the target object's children.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public void DetachChildren()

Remarks

Each immediate child is moved to the root-level, preserving their internal hierarchies. This is useful if you want to destroy the root of a hierarchy without destroying the children, and is more efficient than unparenting each child individually.
Additional Resources: Transform.parent to detach/change the parent of a single transform.

Examples

{code Tests/EditModeAndPlayModeTests/Transform/Assets/DocumentationExamples/DocExamples_TransformHierarchy.cs#transform-detachchildren-example}