ObjectIndexer
A specialized SearchIndexer which provides methods to index a Unity Object from custom indexers.
Read time 3 minutesLast updated 5 days ago
Definition
- Type: Class
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
- Inherits from: SearchIndexer
- Implements: IDisposable
public abstract class ObjectIndexer : SearchIndexer, IDisposable
Remarks
The ObjectIndexer can only be used in the context of a CustomObjectIndexerAttribute and therefore cannot be instanciated explicitly.
[CustomObjectIndexer(typeof(Collider), version = 3)] static void IndexObjectSize(CustomObjectIndexerTarget target, ObjectIndexer indexer) { var collider = target.target as Collider; if (collider == null) return; var totalSize = CustomSelectors.ComputeColliderSize(collider); indexer.IndexNumber(target.documentIndex, "collidersize", totalSize); }
Note that you can use all of the SearchIndexer indexing methods to add words, properties and numbers to the search index database. You can also use the following higher level functions (i.e. IndexWord, IndexNumber, IndexProperty, IndexWordComponents and IndexPropertyComponents) to index common Unity Object properties.
Add*Methods
Method | Description |
|---|---|
| IndexNumber | Adds a key-number value pair to the index. The key won't be added with variations. |
| IndexProperty | Adds a property value to the index. A property is specified with a key and a string value. |
| IndexPropertyComponents | Indexes multiple variations of a property value. |
| IndexWord | Adds a new word coming from a specific document to the index. |
| IndexWordComponents | Splits a word into multiple variations. |