# SetupDepthsFromParentsAndChildren(TreeViewItem)

> Utility method using the depth of the input TreeViewItem to set the correct depths for all its descendant TreeViewItems.

## Definition

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

```csharp
protected static void SetupDepthsFromParentsAndChildren(TreeViewItem root)
```

### Parameters

**** (\[TreeViewItem]\(/engine/6000.0/script-reference/unityeditor/imgui/controls/treeviewitem)): TreeViewItem from which the descendentans should have their depth updated.

### Remarks

This method can be used to intitialize the TreeViewItems depth values after setting up the children properties of the TreeViewItems.

Additional Resources: [TreeView.SetupDepthsFromParentsAndChildren](/engine/6000.0/script-reference/unityeditor/imgui/controls/treeview/setupdepthsfromparentsandchildren.md), [TreeView.BuildRoot()](/engine/6000.0/script-reference/unityeditor/imgui/controls/treeview/buildroot.md).
