Version: 2022.3
언어: 한국어

CustomObjectIndexerAttribute

class in UnityEditor.Search

매뉴얼로 전환

설명

Allows a user to register a custom Indexing function for a specific type.

When you have special properties you would like to index for an asset or a Unity Object, Unity suggests Writing a custom indexer routine . The newly indexed words or properties will allow the user to search for them using the Search Query Language. The registered function must be of type: static void MyCustomIndexer(CustomObjectIndexerTarget context, ObjectIndexer indexer);

See ObjectIndexer for the various methods you can invoke on indexer.

The CustomObjectIndexerTarget context argument can be used to access additional information about what is about to be indexed.

[CustomObjectIndexer(typeof(Material))]
internal static void MaterialShaderReferences(CustomObjectIndexerTarget context, ObjectIndexer indexer)
{
   var material = context.target as Material;
   if (material == null)
       return;

if (material.shader) { var fullShaderName = material.shader.name.ToLowerInvariant(); var shortShaderName = System.IO.Path.GetFileNameWithoutExtension(fullShaderName); indexer.AddProperty("ref", shortShaderName, context.documentIndex); indexer.AddProperty("ref", fullShaderName, context.documentIndex); } }

변수

typeEach time an object of a specific type is indexed, the registered function is called.
versionVersion of the custom indexer. Increment this number to have the indexer re-index the indexes.

생성자

CustomObjectIndexerAttributeRegister a new Indexing function bound to the specific type.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961