# CreatePickerState

> Create a SearchViewState specially setup to show an Object Picker.

## Definition

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

## CreatePickerState(string, SearchContext, Action\<Object, bool>, Action\<Object>, string, Type, SearchViewFlags)

Create a SearchViewState specially setup to show an Object Picker.

```csharp
public static SearchViewState CreatePickerState(string title, SearchContext context, Action<Object, bool> selectObjectHandler, Action<Object> trackingObjectHandler, string typeName, Type filterType, SearchViewFlags flags = SearchViewFlags.None)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Title of the picker window.**** (\[SearchContext]\(/engine/6000.6/script-reference/unityeditor/search/searchcontext)): SearchContext used to setup whcih SearchProvider and initial query are setup for this Picker.**** (\[Action\<Object, bool>]\(https\://learn.microsoft.com/dotnet/api/system.action)): Selector Callback.**** (\[Action\<Object>]\(https\://learn.microsoft.com/dotnet/api/system.action)): Callbacks triggeeds when the select selects an item.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Name of the type of assets or components we want to pick.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): Type of the items we want to pick.**** (\[SearchViewFlags]\(/engine/6000.6/script-reference/unityengine/search/searchviewflags)): Flags specifying how the picker view should be displayed.

### Returns

| Type                                                                                     | Description                                        |
| ---------------------------------------------------------------------------------------- | -------------------------------------------------- |
| [SearchViewState](/engine/6000.6/script-reference/unityeditor/search/searchviewstate.md) | Returns a view state use to open an Object picker. |

## CreatePickerState(string, SearchContext, Action\<SearchItem, bool>, Action\<SearchItem>, Func\<SearchItem, bool>, SearchViewFlags)

Create a SearchViewState specially setup to show an Object Picker.

```csharp
public static SearchViewState CreatePickerState(string title, SearchContext context, Action<SearchItem, bool> selectHandler, Action<SearchItem> trackingHandler = null, Func<SearchItem, bool> filterHandler = null, SearchViewFlags flags = SearchViewFlags.None)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Title of the picker window.**** (\[SearchContext]\(/engine/6000.6/script-reference/unityeditor/search/searchcontext)): SearchContext used to setup whcih SearchProvider and initial query are setup for this Picker.**** (\[Action\<SearchItem, bool>]\(https\://learn.microsoft.com/dotnet/api/system.action)): Selector Callback.**** (\[Action\<SearchItem>]\(https\://learn.microsoft.com/dotnet/api/system.action)): Callbacks triggeeds when the select selects an item.**** (\[Func\<SearchItem, bool>]\(https\://learn.microsoft.com/dotnet/api/system.func-1)): Filtering calback.**** (\[SearchViewFlags]\(/engine/6000.6/script-reference/unityengine/search/searchviewflags)): Flags specifying how the picker view should be displayed.

### Returns

| Type                                                                                     | Description                                        |
| ---------------------------------------------------------------------------------------- | -------------------------------------------------- |
| [SearchViewState](/engine/6000.6/script-reference/unityeditor/search/searchviewstate.md) | Returns a view state use to open an Object picker. |
