# SetSorting(int, bool)

> Sets the primary sorting column and its sorting order.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.IMGUI.Controls](/engine/6000.3/script-reference/unityeditor/imgui/controls.md)
* **Assembly:** UnityEditor

```csharp
public void SetSorting(int columnIndex, bool sortAscending)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Column to sort.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Sorting order for the column specified.

### Remarks

This function sets the primary sorting column and its sorting order. It also triggers the [MultiColumnHeader.sortingChanged](/engine/6000.3/script-reference/unityeditor/imgui/controls/multicolumnheader/sortingchanged.md) event if the sorting state changes. You can set the columnIndex to -1 to clear the sort.

Additional Resources: [MultiColumnHeader.SetSortingColumns](/engine/6000.3/script-reference/unityeditor/imgui/controls/multicolumnheader/setsortingcolumns.md), [MultiColumnHeader.sortedColumnIndex](/engine/6000.3/script-reference/unityeditor/imgui/controls/multicolumnheader/sortedcolumnindex.md) and [MultiColumnHeader.IsSortedAscending](/engine/6000.3/script-reference/unityeditor/imgui/controls/multicolumnheader/issortedascending.md).g.
