docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SearchService

    Principal Quick Search API to initiate searches and fetch results.

    Inheritance
    object
    SearchService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.Search
    Assembly: com.unity.quicksearch.dll
    Syntax
    public static class SearchService

    Properties

    OrderedProviders

    Returns the list of providers sorted by priority.

    Declaration
    public static IEnumerable<SearchProvider> OrderedProviders { get; }
    Property Value
    Type Description
    IEnumerable<SearchProvider>

    Providers

    Returns the list of all providers (active or not)

    Declaration
    public static List<SearchProvider> Providers { get; }
    Property Value
    Type Description
    List<SearchProvider>

    Methods

    CreateContext(IEnumerable<string>, string, SearchFlags)

    Create context from a list of provider id.

    Declaration
    public static SearchContext CreateContext(IEnumerable<string> providerIds, string searchText = "", SearchFlags flags = SearchFlags.Default)
    Parameters
    Type Name Description
    IEnumerable<string> providerIds

    List of provider id

    string searchText

    seach Query

    SearchFlags flags

    Options defining how the query will be performed

    Returns
    Type Description
    SearchContext

    New SearchContext

    CreateContext(IEnumerable<SearchProvider>, string, SearchFlags)

    Create context from a list of providers.

    Declaration
    public static SearchContext CreateContext(IEnumerable<SearchProvider> providers, string searchText = "", SearchFlags flags = SearchFlags.Default)
    Parameters
    Type Name Description
    IEnumerable<SearchProvider> providers

    List of providers

    string searchText

    seach Query

    SearchFlags flags

    Options defining how the query will be performed

    Returns
    Type Description
    SearchContext

    New SearchContext

    CreateContext(string)

    Declaration
    public static SearchContext CreateContext(string searchText)
    Parameters
    Type Name Description
    string searchText
    Returns
    Type Description
    SearchContext

    CreateContext(string, string, SearchFlags)

    Create a search context for a single search provider.

    Declaration
    public static SearchContext CreateContext(string providerId, string searchText = "", SearchFlags flags = SearchFlags.Default)
    Parameters
    Type Name Description
    string providerId

    Search provider ID string (such as asset, scene, find, etc.)

    string searchText

    Initial search text to be used to evaluate the query.

    SearchFlags flags

    Additional search options to be used for the query evaluation.

    Returns
    Type Description
    SearchContext

    The newly created search context. You need to call Dispose on the SearchContext when you are done using it for queries.

    CreateContext(string, SearchFlags)

    Create a search context with all active providers.

    Declaration
    public static SearchContext CreateContext(string searchText, SearchFlags flags)
    Parameters
    Type Name Description
    string searchText
    SearchFlags flags
    Returns
    Type Description
    SearchContext

    CreateContext(SearchProvider, string)

    Create a search context with a single search provider.

    Declaration
    public static SearchContext CreateContext(SearchProvider provider, string searchText = "")
    Parameters
    Type Name Description
    SearchProvider provider
    string searchText
    Returns
    Type Description
    SearchContext

    CreateIndex(in string, in IndexingOptions, IEnumerable<string>, IEnumerable<string>, IEnumerable<string>, Action<string, string, Action>)

    Create a new index and callback user code to indicate that the indexing is finished.

    Declaration
    public static void CreateIndex(in string name, in IndexingOptions options, IEnumerable<string> roots, IEnumerable<string> includes, IEnumerable<string> excludes, Action<string, string, Action> onIndexReady)
    Parameters
    Type Name Description
    string name

    Unique name of the index to be used.

    IndexingOptions options
    IEnumerable<string> roots
    IEnumerable<string> includes
    IEnumerable<string> excludes
    Action<string, string, Action> onIndexReady

    Callback invoked when the new search index is ready to be used.

    GetAction(SearchProvider, string)

    Returns the search action data for a given provider and search action id.

    Declaration
    public static SearchAction GetAction(SearchProvider provider, string actionId)
    Parameters
    Type Name Description
    SearchProvider provider

    Provider to lookup

    string actionId

    Unique action ID within the provider.

    Returns
    Type Description
    SearchAction

    The matching action

    GetItems(SearchContext, SearchFlags)

    Initiate a search and return all search items matching the search context. Other items can be found later using the asynchronous searches.

    Declaration
    public static List<SearchItem> GetItems(SearchContext context, SearchFlags options = SearchFlags.Default)
    Parameters
    Type Name Description
    SearchContext context

    The current search context

    SearchFlags options

    Options defining how the query will be performed

    Returns
    Type Description
    List<SearchItem>

    A list of search items matching the search query.

    GetProvider(string)

    Returns the data of a search provider given its ID.

    Declaration
    public static SearchProvider GetProvider(string providerId)
    Parameters
    Type Name Description
    string providerId

    Unique ID of the provider

    Returns
    Type Description
    SearchProvider

    The matching provider

    IsIndexReady(string)

    Checks if a search index is ready to be used.

    Declaration
    public static bool IsIndexReady(string name)
    Parameters
    Type Name Description
    string name

    Name or path of the search index to be checked. Pass null if you want to check all available indexes

    Returns
    Type Description
    bool

    Refresh()

    Clears everything and reloads all search providers.

    Declaration
    public static void Refresh()
    Remarks

    Use with care. Useful for unit tests.

    RefreshWindows()

    Refreshes all open windows.

    Declaration
    public static void RefreshWindows()

    Request(string, Action<SearchContext, IEnumerable<SearchItem>>, Action<SearchContext>, SearchFlags)

    Execute a search request and callback for every incoming items and when the search is completed. This will create a new search context that will be Disposed when the request is finished.

    Declaration
    public static void Request(string searchText, Action<SearchContext, IEnumerable<SearchItem>> onIncomingItems, Action<SearchContext> onSearchCompleted, SearchFlags options = SearchFlags.None)
    Parameters
    Type Name Description
    string searchText
    Action<SearchContext, IEnumerable<SearchItem>> onIncomingItems
    Action<SearchContext> onSearchCompleted
    SearchFlags options

    Request(string, Action<SearchContext, IList<SearchItem>>, SearchFlags)

    Execute a search request and callback when the search is completed. This will create a new search context that will be Disposed when the request is finished.

    Declaration
    public static void Request(string searchText, Action<SearchContext, IList<SearchItem>> onSearchCompleted, SearchFlags options = SearchFlags.None)
    Parameters
    Type Name Description
    string searchText
    Action<SearchContext, IList<SearchItem>> onSearchCompleted
    SearchFlags options

    Request(string, SearchFlags)

    Run a query on all active providers.

    Declaration
    public static ISearchList Request(string searchText, SearchFlags options = SearchFlags.None)
    Parameters
    Type Name Description
    string searchText

    Search query to execute.

    SearchFlags options
    Returns
    Type Description
    ISearchList

    Request(SearchContext, Action<SearchContext, IEnumerable<SearchItem>>, Action<SearchContext>, SearchFlags)

    Execute a search request and callback for every incoming items and when the search is completed. The user is responsible for disposing of the search context.

    Declaration
    public static void Request(SearchContext context, Action<SearchContext, IEnumerable<SearchItem>> onIncomingItems, Action<SearchContext> onSearchCompleted, SearchFlags options = SearchFlags.None)
    Parameters
    Type Name Description
    SearchContext context
    Action<SearchContext, IEnumerable<SearchItem>> onIncomingItems
    Action<SearchContext> onSearchCompleted
    SearchFlags options

    Request(SearchContext, Action<SearchContext, IList<SearchItem>>, SearchFlags)

    Execute a search request and callback when the search is completed. The user is responsible for disposing of the search context.

    Declaration
    public static void Request(SearchContext context, Action<SearchContext, IList<SearchItem>> onSearchCompleted, SearchFlags options = SearchFlags.None)
    Parameters
    Type Name Description
    SearchContext context
    Action<SearchContext, IList<SearchItem>> onSearchCompleted
    SearchFlags options

    Request(SearchContext, SearchFlags)

    Execute a search request that will fetch search results asynchronously.

    Declaration
    public static ISearchList Request(SearchContext context, SearchFlags options = SearchFlags.None)
    Parameters
    Type Name Description
    SearchContext context

    Search context used to track asynchronous request.

    SearchFlags options

    Options defining how the query will be performed

    Returns
    Type Description
    ISearchList

    Asynchronous list of search items.

    SetActive(string, bool)

    Activate or deactivate a search provider. Call Refresh after this to take effect on the next search.

    Declaration
    public static void SetActive(string providerId, bool active = true)
    Parameters
    Type Name Description
    string providerId

    Provider id to activate or deactivate

    bool active

    Activation state

    ShowContextual(params string[])

    Open QuickSearch in contextual mode enabling only the providers specified.

    Declaration
    public static ISearchView ShowContextual(params string[] providerIds)
    Parameters
    Type Name Description
    string[] providerIds

    List of provider ids to enabled for QuickSearch

    Returns
    Type Description
    ISearchView

    Returns the QuickSearch window.

    ShowObjectPicker(Action<Object, bool>, Action<Object>, string, string, Type, float, float, SearchFlags)

    Use Quick Search to as an object picker to select any object based on the specified filter type.

    Declaration
    public static ISearchView ShowObjectPicker(Action<Object, bool> selectHandler, Action<Object> trackingHandler, string searchText, string typeName, Type filterType, float defaultWidth = 850, float defaultHeight = 539, SearchFlags flags = SearchFlags.None)
    Parameters
    Type Name Description
    Action<Object, bool> selectHandler

    Callback to trigger when a user selects an item.

    Action<Object> trackingHandler

    Callback to trigger when the user is modifying QuickSearch selection (i.e. tracking the currently selected item)

    string searchText

    Initial search text for QuickSearch.

    string typeName

    Type name of the object to select. Can be used to replace filterType.

    Type filterType

    Type of the object to select.

    float defaultWidth

    Initial width of the window.

    float defaultHeight

    Initial height of the window.

    SearchFlags flags

    Options flags modifying how the Search window will be opened.

    Returns
    Type Description
    ISearchView

    Returns the QuickSearch window.

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

    Declaration
    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 = 850, float defaultHeight = 539, SearchFlags flags = SearchFlags.None)
    Parameters
    Type Name Description
    SearchContext context
    Action<SearchItem, bool> selectHandler
    Action<SearchItem> trackingHandler
    Func<SearchItem, bool> filterHandler
    IEnumerable<SearchItem> subset
    string title
    float itemSize
    float defaultWidth
    float defaultHeight
    SearchFlags flags
    Returns
    Type Description
    ISearchView

    ShowPicker(SearchViewState)

    Open and show the Search Picker window.

    Declaration
    public static ISearchView ShowPicker(SearchViewState viewState)
    Parameters
    Type Name Description
    SearchViewState viewState

    View parameters

    Returns
    Type Description
    ISearchView

    Returns the newly create search view instance.

    ShowWindow(SearchContext, string, float, float, bool, bool, bool, bool)

    Creates and open a new instance of Quick Search

    Declaration
    public static ISearchView ShowWindow(SearchContext context = null, string topic = "Unity", float defaultWidth = 850, float defaultHeight = 539, bool saveFilters = true, bool reuseExisting = false, bool multiselect = true, bool dockable = true)
    Parameters
    Type Name Description
    SearchContext context

    Initial search context of QuickSearch

    string topic

    QuickSearch search topic

    float defaultWidth

    Initial width of the window.

    float defaultHeight

    Initial height of the window.

    bool saveFilters

    True if user provider filters should be saved for next search session

    bool reuseExisting

    If true, try to reuse an already existing instance of QuickSearch. If false will create a new QuickSearch window.

    bool multiselect

    True if the search support multi-selection or not.

    bool dockable

    If true, creates a dockable QuickSearch Window (that will be closed when an item is activated). If false, it will create a DropDown (borderless, undockable and unmovable) version of QuickSearch.

    Returns
    Type Description
    ISearchView

    Returns the Quick Search editor window instance.

    ShowWindow(SearchViewState)

    Show a search window.

    Declaration
    public static ISearchView ShowWindow(SearchViewState viewState)
    Parameters
    Type Name Description
    SearchViewState viewState

    Defines search view parameters for creation

    Returns
    Type Description
    ISearchView
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)