Version: 2023.1

SearchContextAttributeConstructor

切换到手册
public SearchContextAttribute (string query);
public SearchContextAttribute (string query, Search.SearchViewFlags flags);
public SearchContextAttribute (string query, string providerIdsCommaSeparated);
public SearchContextAttribute (string query, string providerIdsCommaSeparated, Search.SearchViewFlags flags);
public SearchContextAttribute (string query, params Type[] instantiableProviders);
public SearchContextAttribute (string query, Search.SearchViewFlags flags, params Type[] instantiableProviders);
public SearchContextAttribute (string query, Search.SearchViewFlags flags, string providerIdsCommaSeparated, params Type[] instantiableProviders);

参数

query Initial search query text used to open the Object Picker window.
flags Search view flags used to open the Object Picker in various states.
providerIdsCommaSeparated A list of Search Provider IDs that will be used to create the search context.
instantiableProviders Search provider concrete types that will be instantiated and assigned to the Object Picker search context.

描述

Search context constructor used to add some search context to an object field.

const string assetProviders = "adb;asset";
const string objectProviders = "adb,asset,scene";

[SearchContext("cub", "adb", SearchViewFlags.ListView)] public MonoScript myProjectScript;
[SearchContext("script", "adb", SearchViewFlags.Packages | SearchViewFlags.CompactView)] public MonoScript myPackageScript;
[SearchContext("t:texture", assetProviders, SearchViewFlags.GridView)] public Texture myTexture;
[SearchContext("t:texture", "adb", SearchViewFlags.OpenInspectorPreview)] public Texture myTextureWithInspector;
[SearchContext("non_mobile", SearchViewFlags.Centered)] public UnityEngine.Object myAnyObject;
[SearchContext("non_mobile", SearchViewFlags.Debug)] public UnityEngine.Object myDebugObject;
[SearchContext("t:mesh is:nested mesh", "asset")] public UnityEngine.Object assetMesh;
[SearchContext("h:cube", objectProviders)] public MeshFilter sceneMesh;
[SearchContext("shader:standard", assetProviders, SearchViewFlags.HideSearchBar)] public Material materialNoSearchBar;
[SearchContext("select{p:t:material, @label, @size}", objectProviders, SearchViewFlags.TableView)] public Material selectMaterial;
[SearchContext("Assets/Queries/textures.asset", assetProviders)] public Texture searchQueryPathTexture;
[SearchContext("3c7f5dff3fb5d724688dfcecfb131b2a", assetProviders)] public Texture searchQueryGuidTexture;
[SearchContext("non_mobile", SearchViewFlags.EnableSearchQuery)] public UnityEngine.Object myObjectWithSearchQueryEnabled;
[SearchContext("non_mobile", SearchViewFlags.DisableInspectorPreview)] public UnityEngine.Object myObjectWithInspectorDisabled;
[SearchContext("p: t:texture", "asset", SearchViewFlags.OpenInBuilderMode)] public Texture myTextureWithBuilder;
[SearchContext("p: t:texture", "asset", SearchViewFlags.OpenInBuilderMode | SearchViewFlags.DisableBuilderModeToggle)] public Texture myTextureWithBuilderNoToggle;
[SearchContext("p: t:texture", "asset", SearchViewFlags.OpenInTextMode | SearchViewFlags.DisableBuilderModeToggle)] public Texture myTextureNoBuilderNoToggle;
[SearchContext("t:currentobject{@type, 'texture'}", "asset")] public UnityEngine.Object myObjectWithContext;


[SearchContext("light")] public UnityEngine.GameObject lightSearch;
[SearchContext("camera")] public UnityEngine.GameObject cameraSearch;

#if USE_QUERY_BUILDER
[SearchContext("p: t:<$list:Texture2D, [Texture2D, Material, Prefab]$>", "asset", SearchViewFlags.OpenInBuilderMode | SearchViewFlags.DisableBuilderModeToggle)] public UnityEngine.Object myObjectOfConstrainedTypes;
#endif
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961