Version: 2023.1
LanguageEnglish
  • C#

SearchViewState

class in UnityEditor.Search


Implements interfaces:ISerializationCallbackReceiver

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 view state is used to create new Search windows. See SearchService.ShowWindow.

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

Static Properties

defaultSizeDetermine the default search view size when it first opens.

Properties

contextSearch context used to populate the search view.
excludeClearItemSet to true to hide the None item when in picker mode.
flagsVarious search view options.
groupIndicates the group or tab to be selected when the Search window opens.
groupChangedExternal handler used to be notified when the user changes the current group/tab.
hasWindowSizeDetermines 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.
hideAllGroupDetermine if the All group/tab should be hidden.
hideTabsIndicates if the search tabs (group providers) should be hidden or shown.
ignoreSaveSearchesIf true, the search view will not load previous saved searches.
itemSizeIndicates the item size to be used when the Search window opens.
positionIf defined, indicates the location of the new Search window when it opens.
queryBuilderEnabledIf true, the search view will be opened in builder mode.
selectHandlerExternal handler triggered when the user has selected an item in picker mode.
sessionIdUnique session ID generated by the system each time a search view is opened.
tableConfigAccess the search table configuration used if in table view.
textText used to initialize the search view.
titleIndicates the search topic title.
trackingHandlerExternal handler triggered each time the user clicks on an item in the search view.
windowSizeDetermine the size the search view was opened with.
windowTitleIf defined, this title will be used to open a new search view and sets the EditorWindow.titleContent.

Constructors

SearchViewStateCreate search view flags used to create a new Search window.

Public Methods

GetProviderIdsReturns all the search provider ids in the current search context.
GetProviderTypesReturns all the search provider types in the current search context.
HasFlagChecks if the search view was defined with specific set of flags.

Static Methods

LoadDefaultsReturns a newly created default search view state.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961