# AddItem<T>(TreeViewItemData<T>, int, int, bool)

> Adds an item to the existing tree.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.5/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public void AddItem<T>(TreeViewItemData<T> item, int parentId = -1, int childIndex = -1, bool rebuildTree = true)
```

### Parameters

**** (\[TreeViewItemData\<T>]\(/engine/6000.5/script-reference/unityengine/uielements/treeviewitemdata1)): Item to add.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The parent id for the item.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The child index in the parent's children list.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether we should call RebuildTree and RefreshItems or not. Set to false when doing multiple additions to save a few rebuilds.
