版本:Unity 6 (6000.0)
语言英语
  • C#

SearchContextAttribute 构造函数

建议更改

成功!

感谢您帮助我们提升 Unity 文档的质量。尽管我们无法接受所有投稿,但我们确实会阅读用户建议的每一处更改,并在适用时进行更新。

关闭

提交失败

由于某种原因,您的建议更改无法提交。请在几分钟后 <a>重试</a>。感谢您花时间帮助我们提升 Unity 文档的质量。

关闭

取消

声明

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 用于打开对象选择器窗口的初始搜索查询文本。
flags 用于在各种状态下打开对象选择器的搜索视图标志。
providerIdsCommaSeparated 用于创建搜索上下文的搜索提供程序 ID 列表。
instantiableProviders 搜索提供程序具体类型,将实例化并分配到对象选择器搜索上下文中。

描述

搜索上下文构造函数,用于向对象字段添加一些搜索上下文。

const string assetProviders = "adb;asset";
const string objectProviders = "adb,asset,scene";
const SearchViewFlags pickerMinimalUIFlags = SearchViewFlags.Packages |
    SearchViewFlags.IgnoreSavedSearches |
    SearchViewFlags.DisableSavedSearchQuery |
    SearchViewFlags.OpenInBuilderMode |
    SearchViewFlags.DisableBuilderModeToggle |
    SearchViewFlags.IgnoreSavedSearches;

[SearchContext("cub", "adb", SearchViewFlags.ObjectPickerAdvancedUI | SearchViewFlags.ListView | SearchViewFlags.IgnoreSavedSearches)] public MonoScript myProjectScript;
[SearchContext("script", "adb", SearchViewFlags.Packages | SearchViewFlags.CompactView)] public MonoScript myPackageScript;
[SearchContext("t:texture", assetProviders, SearchViewFlags.ObjectPickerAdvancedUI | SearchViewFlags.GridView)] public Texture myTexture;
[SearchContext("t:texture", assetProviders, SearchViewFlags.ObjectPickerAdvancedUI | SearchViewFlags.GridView)] public Texture[] myTextureArray;
[SearchContext("t:texture", assetProviders, SearchViewFlags.ObjectPickerAdvancedUI | SearchViewFlags.GridView)] public List<Texture> myTextureList;
[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", "scene")] 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.ObjectPickerAdvancedUI | SearchViewFlags.EnableSearchQuery)] public UnityEngine.Object myObjectWithSearchQueryEnabled;
[SearchContext("non_mobile", SearchViewFlags.ObjectPickerAdvancedUI | SearchViewFlags.DisableInspectorPreview)] public UnityEngine.Object myObjectWithInspectorDisabled;
[SearchContext("p: t:texture", "asset", SearchViewFlags.ObjectPickerAdvancedUI | 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", SearchViewFlags.None)] public UnityEngine.GameObject cameraSearch;

public UnityEngine.GameObject noSearchContext;

#if USE_QUERY_BUILDER
[SearchContext("p: t:<$list:Texture2D, [Texture2D, Material, Prefab]$>", "asset", SearchViewFlags.OpenInBuilderMode | SearchViewFlags.DisableBuilderModeToggle)] public UnityEngine.Object myObjectOfConstrainedTypes;
#endif