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 10 days ago

Definition

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

DetachChildren(HierarchyNode)

public bool DetachChildren(in HierarchyNode node)

Parameters

The hierarchy node whose children are detached.

Returns

Type

Description

bool
true
if the command was appended to the list,
false
otherwise.

Remarks

Equivalent to calling HierarchyCommandList.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. Nothing reclaims them: the caller must either re-attach them with HierarchyCommandList.SetParent or delete them with HierarchyCommandList.Remove.