Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


DetachChildren(in HierarchyNode)

Severs every child of a hierarchy node from it, without removing them from the hierarchy.
Read time 1 minuteLast updated 17 days ago

Definition

  • Type: Method
  • Namespace: Unity.Hierarchy
  • Assembly: UnityEngine.HierarchyCoreModule

DetachChildren(HierarchyNode)

public void DetachChildren(in HierarchyNode node)

Parameters

The hierarchy node whose children are detached.

Remarks

Equivalent to calling Hierarchy.Detach on each child, but the node's children are severed in a single operation. Each detached child keeps its own children and is no longer reachable from Hierarchy.Root, so none of them appear in a HierarchyFlattened or a HierarchyViewModel. Nothing reclaims them: the caller must either re-attach them with Hierarchy.SetParent or delete them with Hierarchy.Remove.