# TreeViewItem

> The TreeViewItem is used to build the tree representation of a tree data structure.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor.IMGUI.Controls](/engine/6000.3/script-reference/unityeditor/imgui/controls.md)
* **Assembly:** UnityEditor
* **Inherits from:** [TreeViewItem\<int>](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem1.md)
* **Implements:** [IComparable\<TreeViewItem\<int>>](https://learn.microsoft.com/dotnet/api/system.icomparable-1)

> **Warning:**
>
> **Deprecated.** TreeViewItem is now deprecated. You can likely now use TreeViewItem\\\<int\\> instead and not think more about it. But if you were using that identifier to store InstanceID data, you should instead opt to upgrade your TreeViews to use TreeViewItem\\\<InstanceID\\> to get the proper typing.

```csharp
public class TreeViewItem : TreeViewItem<int>, IComparable<TreeViewItem<int>>
```

## Remarks

The TreeViewItem can be derived from to add custom data.

Additional Resources: [TreeView](/engine/6000.3/script-reference/unityengine/uielements/treeview.md).

## Constructors

| Constructor                                                                                                                                                             | Description               |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| [TreeViewItem()](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/ctor.md#treeviewitem\(\))                                                      | TreeViewItem constructor. |
| [TreeViewItem(System.Int32)](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/ctor.md#treeviewitem\(int\))                                       | TreeViewItem constructor. |
| [TreeViewItem(System.Int32,System.Int32)](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/ctor.md#treeviewitem\(int-int\))                      | TreeViewItem constructor. |
| [TreeViewItem(System.Int32,System.Int32,System.String)](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/ctor.md#treeviewitem\(int-int-string\)) | TreeViewItem constructor. |

## Properties

| Property                                                                                        | Description                                                                                             |
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [children](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/children.md) | The list of child items of this TreeViewItem.                                                           |
| [parent](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/parent.md)     | The parent of this TreeViewItem. If it is null then it is considered the root of the TreeViewItem tree. |

## Methods

| Method                                                                                          | Description                                                                                                                                                                                                            |
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AddChild](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/addchild.md) | Helper method that adds the `child` TreeViewItem to the [TreeViewItem.children](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem/children.md) list and sets the parent property on the `child`. |

## Inheritance

**Inherited Members:**

* [TreeViewItem\<int>.AddChild(TreeViewItem\<int>)](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem1/addchild.md)
* [TreeViewItem\<int>.id](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem1/id.md)
* [TreeViewItem\<int>.displayName](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem1/displayname.md)
* [TreeViewItem\<int>.depth](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem1/depth.md)
* [TreeViewItem\<int>.hasChildren](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem1/haschildren.md)
* [TreeViewItem\<int>.icon](/engine/6000.3/script-reference/unityeditor/imgui/controls/treeviewitem1/icon.md)
