Version: 2021.1

SearchFlags

enumeration

切换到手册

描述

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);
    }
}

变量

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.
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.