SearchViewState
Search view state is used to create new Search windows. See SearchService.ShowWindow.
Read time 3 minutesLast updated 7 days ago
Definition
- Type: Class
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
- Implements: ISerializationCallbackReceiver
public class SearchViewState : ISerializationCallbackReceiver
Examples
using UnityEditor;using UnityEditor.Search;using UnityEngine.Search;static class SearchWindows{ [MenuItem("Search/Views/Simple Search Bar 1")] public static void SearchViewFlags1() => CreateWindow(SearchViewFlags.None); [MenuItem("Search/Views/Simple Search Bar 2")] public static void SearchViewFlags2() => CreateWindow(SearchViewFlags.EnableSearchQuery); [MenuItem("Search/Views/Simple Search Bar 3")] public static void SearchViewFlags3() => CreateWindow(SearchViewFlags.DisableInspectorPreview); [MenuItem("Search/Views/Simple Search Bar 4")] public static void SearchViewFlags4() => CreateWindow(SearchViewFlags.EnableSearchQuery | SearchViewFlags.DisableInspectorPreview); static void CreateWindow(SearchViewFlags flags) { var searchContext = SearchService.CreateContext(string.Empty); var viewArgs = new SearchViewState(searchContext, SearchViewFlags.CompactView | flags) { title = flags.ToString() }; SearchService.ShowWindow(viewArgs); }}
Fields
Value | Description |
|---|---|
| excludeClearItem | Set to true to hide the None item when in picker mode. |
| flags | Various search view options. |
| group | Indicates the group or tab to be selected when the Search window opens. |
| hideAllGroup | Determine if the All group/tab should be hidden. |
| hideTabs | Indicates if the search tabs (group providers) should be hidden or shown. |
| ignoreSaveSearches | If true, the search view will not load previous saved searches. |
| position | If defined, indicates the location of the new Search window when it opens. |
| queryBuilderEnabled | If true, the search view will be opened in builder mode. |
| sessionId | Unique session ID generated by the system each time a search view is opened. |
| tableConfig | Access the search table configuration used if in table view. |
| title | Indicates the search topic title. |
| windowTitle | If defined, this title will be used to open a new search view and sets the _titleContent. |
Static Fields
Value | Description |
|---|---|
| defaultSize | Determine the default search view size when it first opens. |
Constructors
Constructor | Description |
|---|---|
| SearchViewState(UnityEditor.Search.SearchContext) | Create search view flags used to create a new Search window. |
| SearchViewState(UnityEditor.Search.SearchContext,System.Action{UnityEditor.Search.SearchItem,System.Boolean}) | Creates a search view state that will be used to open a search picker using SearchService.ShowPicker. |
| SearchViewState(UnityEditor.Search.SearchContext,System.Action{UnityEngine.Object,System.Boolean},System.Action{UnityEngine.Object},System.String,System.Type) | Creates a search view state that will be used to open a search picker using SearchService.ShowPicker. |
| SearchViewState(UnityEditor.Search.SearchContext,UnityEditor.Search.SearchTable,UnityEngine.Search.SearchViewFlags) | Creates a search view that will be opened in table view. |
| SearchViewState(UnityEditor.Search.SearchContext,UnityEngine.Search.SearchViewFlags) | Create search view flags used to create a new Search window. |
Properties
Property | Description |
|---|---|
| context | Search context used to populate the search view. |
| groupChanged | External handler used to be notified when the user changes the current group/tab. |
| hasQueryPanel | Is the SearchViewState allows for the left side Query panel to be shown. |
| hasWindowSize | Determines if the search view was opened with a predefined size. If false, then it means the search view was opened the previous window size it was last closed with. |
| isQueryPanelVisible | Is the Left side query panel shown? |
| itemIconSize | Defines the size of items in the search view. |
| selectHandler | External handler triggered when the user has selected an item in picker mode. |
| text | Text used to initialize the search view. |
| trackingHandler | External handler triggered each time the user clicks on an item in the search view. |
| windowSize | Determine the size the search view was opened with. |
Methods
Method | Description |
|---|---|
| GetProviderIds | Returns all the search provider ids in the current search context. |
| GetProviderTypes | Returns all the search provider types in the current search context. |
| HasFlag | Checks if the search view was defined with specific set of flags. |
| ToString | Convert SearchViewState to a string. |
Static Methods
Method | Description |
|---|---|
| CreatePickerState | Create a SearchViewState specially setup to show an Object Picker. |
| LoadDefaults | Returns a newly created default search view state. |