# TryRemoveItem(int, bool)

> Removes an item of the tree if it can find it.

## Definition

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

```csharp
public bool TryRemoveItem(int id, bool rebuildTree = true)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The item id.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether we need to rebuild tree data. Set to false when doing multiple additions to save a few rebuilds.

### Returns

| Type                                                          | Description                            |
| ------------------------------------------------------------- | -------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If the item was removed from the tree. |
