# ShowPicker

> Open a search item picker window.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Search](/engine/6000.3/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

## ShowPicker(SearchContext, Action\<SearchItem, bool>, Action\<SearchItem>, Func\<SearchItem, bool>, IEnumerable\<SearchItem>, string, float, float, float, SearchFlags)

Open a search item picker window.

```csharp
public static ISearchView ShowPicker(SearchContext context, Action<SearchItem, bool> selectHandler, Action<SearchItem> trackingHandler = null, Func<SearchItem, bool> filterHandler = null, IEnumerable<SearchItem> subset = null, string title = null, float itemSize = 64, float defaultWidth = 650, float defaultHeight = 539, SearchFlags flags = SearchFlags.None)
```

### Parameters

**** (\[SearchContext]\(/engine/6000.3/script-reference/unityeditor/search/searchcontext)): Search context to start with.**** (\[Action\<SearchItem, bool>]\(https\://learn.microsoft.com/dotnet/api/system.action)): Callback invoked when an item is selected.**** (\[Action\<SearchItem>]\(https\://learn.microsoft.com/dotnet/api/system.action)): Callback invoked when an item is clicked without it being the final selection.**** (\[Func\<SearchItem, bool>]\(https\://learn.microsoft.com/dotnet/api/system.func-1)): Callback invoked to filter search item results to display.**** (\[IEnumerable\<SearchItem>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)): Initial set of items to be searched.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Topic to search.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Initial result view item size.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Initial width of the window.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Initial height of the window.**** (\[SearchFlags]\(/engine/6000.3/script-reference/unityeditor/search/searchflags)): Options defining how the query is performed.

### Returns

| Type                                                                             | Description                  |
| -------------------------------------------------------------------------------- | ---------------------------- |
| [ISearchView](/engine/6000.3/script-reference/unityeditor/search/isearchview.md) | Creates a new search window. |

## ShowPicker(SearchViewState)

Open a Search Picker window.

```csharp
public static ISearchView ShowPicker(SearchViewState viewState)
```

### Parameters

**** (\[SearchViewState]\(/engine/6000.3/script-reference/unityeditor/search/searchviewstate)): Search view state used to open the Search Picker window.

### Returns

| Type                                                                             | Description                  |
| -------------------------------------------------------------------------------- | ---------------------------- |
| [ISearchView](/engine/6000.3/script-reference/unityeditor/search/isearchview.md) | Creates a new search window. |

### Remarks

This example shows how to open a custom search picker to pick a decal material.

### Examples

```csharp
using UnityEditor;
using UnityEditor.Search;
using UnityEngine;
using UnityEngine.Search;

static class Example_SearchService_ShowPicker
{
    [MenuItem("Examples/SearchService/ShowPicker")]
    public static void Run()
    {
        var context = SearchService.CreateContext("asset", "t:material");
        var viewState = new SearchViewState(context,
            SearchViewFlags.GridView |
            SearchViewFlags.OpenInBuilderMode |
            SearchViewFlags.DisableSavedSearchQuery)
        {
            windowTitle = new GUIContent("Material Selector"),
            title = "Material",
            selectHandler = SelectHandler,
            trackingHandler = TrackingHandler,
            position = SearchUtils.GetMainWindowCenteredPosition(new Vector2(600, 400))
        };
        SearchService.ShowPicker(viewState);
    }

    static void SelectHandler(SearchItem searchItem, bool canceled)
    {
        Debug.Log($"Selected {searchItem} (canceled: {canceled})");
    }

    static void TrackingHandler(SearchItem searchItem)
    {
        Debug.Log($"Tracking {searchItem}");
    }
}
```
