# GetDescendantsThatHaveChildren(int)

> Returns all descendants for the item with ID id that have children.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.IMGUI.Controls](/engine/6000.0/script-reference/unityeditor/imgui/controls.md)
* **Assembly:** UnityEditor

```csharp
protected virtual IList<int> GetDescendantsThatHaveChildren(int id)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): TreeViewItem ID.

### Returns

| Type                                                                                     | Description                     |
| ---------------------------------------------------------------------------------------- | ------------------------------- |
| [IList\<int>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1) | Descendants that have children. |

### Remarks

It is used for expanding entire sub-trees. It is called automatically from some TreeView methods. If the full item tree has not been built in BuildRoot(), then override this method and use your back-end data to find the correct descendants for the given item.

Default behavior: The item with ID id is found by searching from the rootItem through all its descendants. Once found, all its descendants that have children are collected. Assumes the full tree has been built.

Additional Resources: [TreeView.GetAncestors](/engine/6000.0/script-reference/unityeditor/imgui/controls/treeview/getancestors.md).
