# SetSelection

> Sets the currently selected item.

## Definition

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

## SetSelection(int)

Sets the currently selected item.

```csharp
public void SetSelection(int index)
```

### Parameters

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

## SetSelection(IEnumerable\<int>)

Sets a collection of selected items.

```csharp
public void SetSelection(IEnumerable<int> indices)
```

### Parameters

**** (\[IEnumerable\<int>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)): The collection of the indices of the items to be selected.
