# SetSelectionById

> Sets the currently selected item by id.

## Definition

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

## SetSelectionById(int)

Sets the currently selected item by id.

```csharp
public void SetSelectionById(int id)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The item id.

### Remarks

This will also expand the selected item if not expanded already.

## SetSelectionById(IEnumerable\<int>)

Sets a collection of selected items by ids.

```csharp
public void SetSelectionById(IEnumerable<int> ids)
```

### Parameters

**** (\[IEnumerable\<int>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)): The item ids.

### Remarks

This will also expand the selected items if not expanded already.
