# TreeViewItem<TIdentifier>

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

## Definition

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

```csharp
public class TreeViewItem<TIdentifier> : IComparable<TreeViewItem<TIdentifier>>
```

## Remarks

The TreeViewItem can be derived from to add custom data.

Additional Resources: [TreeView\<TIdentifier>](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeview1.md).

## Constructors

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

## Properties

| Property                                                                                               | Description                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [children](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/children.md)       | The list of child items of this TreeViewItem.                                                                                                              |
| [depth](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/depth.md)             | The depth refers to how many ancestors this item has, and corresponds to the number of horizontal ‘indents’ this item has.                                 |
| [displayName](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/displayname.md) | Name shown for this item when rendered.                                                                                                                    |
| [hasChildren](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/haschildren.md) | Returns true if [TreeViewItem\<TIdentifier>.children](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/children.md) has any items. |
| [icon](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/icon.md)               | If set, this icon will be rendered to the left of the displayName. The icon is rendered at 16x16 points by default.                                        |
| [id](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/id.md)                   | Unique ID for an item.                                                                                                                                     |
| [parent](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/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.7/script-reference/unityeditor/imgui/controls/treeviewitem1/addchild.md) | Helper method that adds the `child` TreeViewItem to the [TreeViewItem\<TIdentifier>.children](/engine/6000.7/script-reference/unityeditor/imgui/controls/treeviewitem1/children.md) list and sets the parent property on the `child`. |
