Version: 2021.1
  • C#


class in UnityEditor.Search

Suggest a change


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.


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.




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.

internal static void MaterialShaderReferences(CustomObjectIndexerTarget context, ObjectIndexer indexer)
   var material = as Material;
   if (material == null)

if (material.shader) { var fullShaderName =; 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.