Version: 2022.2
LanguageEnglish
  • C#

SearchFlags

enumeration

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Search options used to fetch items. Mostly with SearchContext to specify how a search should be handled.

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Search;
using UnityEngine;

public class SearchFlags_NoIndexing
{
    [MenuItem("Examples/SearchFlags/NoIndexing")]
    public static void RequestAll()
    {
        // Find all assets matching the word Search without using any indexed data (will rely on the Find Files provider).
        SearchService.Request("p: Search", (SearchContext context, IList<SearchItem> items) =>
        {
            foreach (var item in items)
                Debug.Log(item);
        }, SearchFlags.NoIndexing);
    }
}

Properties

NoneNo specific search options. Result will be unsorted.
SynchronousSearch items are fetched synchronously. This can take a long time for some SearchProvider (like asset). Use at your own risk.
SortedFetched items are sorted by the search service.
FirstBatchAsyncSends the first items asynchronously.
WantsMoreSets the search to search for all results. This might take longer than unusual if SearchProvider are using multiple sources of items (files on disk, AssetDatabase...)
DebugAdds debugging information to SearchItem while looking for results.
NoIndexingPrevents the search from using indexing. Asset Provider will use its builtin Find in Files provider.
ExpressionIndicates that the search query will be evaluated as a search expression.
QueryStringEvaluate the search text as a pure query string (do not evaluate the text as a search expression).
PackagesThe Object Picker window will include any results from packages.
DefaultDefault Search Flag (SearchFlags.Sorted).
ShowErrorsWithResultsAlways show query errors even when there are results available. This flag is only usable with internal API.
SaveFiltersIndicates that the search view will save its settings and search provider filters when it closes. This flag is only usable with internal API.
ReuseExistingWindowIndicates that the search view will find any existing window instances that are already opened before creating a new one. This flag is only usable with internal API.
MultiselectIndicates that the search view will allow multi-selection. This flag is only usable with internal API.
DockableIndicates that the search view is dockable. This flag is only usable with internal API.
FocusContextIndicates that the search view will focus on the first contextual search provider available when it opens. This flag is only usable with internal API.
HidePanelsIndicates that the search view will hide its side panels when it opens. This flag is only usable with internal API.
OpenDefaultOpens a search view with default options. This flag is only usable with internal API.
OpenGlobalOpens a search view for a global search. This flag is only usable with internal API.
OpenContextualOpens a search view with default contextual options. This flag is only usable with internal API.
OpenPickerOpens a search view as an object picker. This flag is only usable with internal API.