context | Search context to start with. |
selectHandler | Callback invoked when an item is selected. |
trackingHandler | Callback invoked when an item is clicked without it being the final selection. |
filterHandler | Callback invoked to filter search item results to display. |
title | Topic to search. |
itemSize | Initial result view item size. |
defaultWidth | Initial width of the window. |
defaultHeight | Initial height of the window. |
subset | Initial set of items to be searched. |
flags | Options defining how the query is performed. |
ISearchView Creates a new search window.
Open a search item picker window.
This example shows how to open a custom search picker to pick a material.
using UnityEditor; using UnityEditor.Search; using UnityEngine; static class Example_SearchService_ShowPicker { [MenuItem("Examples/SearchService/ShowPicker")] public static void Run() { var context = SearchService.CreateContext("asset", "t:material"); SearchService.ShowPicker(context, SelectHandler, TrackingHandler, title: "Material Selector", defaultWidth: 600, defaultHeight: 400); } static void SelectHandler(SearchItem searchItem, bool canceled) { Debug.Log($"Selected {searchItem} (canceled: {canceled})"); } static void TrackingHandler(SearchItem searchItem) { Debug.Log($"Tracking {searchItem}"); } }
viewState | Search view state used to open the Search Picker window. |
ISearchView Creates a new search window.
Open a Search Picker window.