# SortChildren

> Sorts the child nodes of a hierarchy node by their sort index.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Hierarchy](/engine/6000.6/script-reference/unity/hierarchy.md)
* **Assembly:** UnityEngine.HierarchyCoreModule

## SortChildren(HierarchyNode)

Sorts the child nodes of a hierarchy node by their sort index.

```csharp
public bool SortChildren(in HierarchyNode node)
```

### Parameters

**** (\[HierarchyNode]\(/engine/6000.6/script-reference/unity/hierarchy/hierarchynode)): The hierarchy node with child nodes to sort by their index.

### Returns

| Type                                                          | Description                                                        |
| ------------------------------------------------------------- | ------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the command was appended to the list, `false` otherwise. |

## SortChildren(HierarchyNode, bool)

Sorts the child nodes of a hierarchy node by their sort index.

> **Warning:**
>
> **Removed.** SortChildren(node, recurse) with a bool parameter is obsolete, please use SortChildren(node) or SortChildrenRecursive(node) instead.

```csharp
public bool SortChildren(in HierarchyNode node, bool recurse)
```

### Parameters

**** (\[HierarchyNode]\(/engine/6000.6/script-reference/unity/hierarchy/hierarchynode)): The hierarchy node with child nodes to sort by their index.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to sort the child nodes recursively.

### Returns

| Type                                                          | Description                                                        |
| ------------------------------------------------------------- | ------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the command was appended to the list, `false` otherwise. |
