IndexPropertyComponents(int, string, string)
Indexes multiple variations of a property value.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前
Definition
- Type: Method
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
public void IndexPropertyComponents(int documentIndex, string name, string value)
Parameters
Remarks
In the example, indexing "AudioClipComponent", will split the word in many ways and index variations such as "Audio", "Clip", "Component", "ACC", etc.
The user will be able to search the property with instead of having to start with .
mytype:clipaudiousing System.Collections.Generic;using System.Linq;using UnityEditor;using UnityEditor.Search;using UnityEngine;static class Example_ObjectIndexer_IndexPropertyComponents{ [CustomObjectIndexer(typeof(MonoScript), version = 1)] internal static void IndexMonoScriptClassType(CustomObjectIndexerTarget context, ObjectIndexer indexer) { if (!(context.target is MonoScript script)) return; var klass = script.GetClass(); if (klass == null) return; indexer.IndexPropertyComponents(context.documentIndex, "class", klass.Name); } [MenuItem("Examples/ObjectIndexer/IndexPropertyComponents")] public static void Run() { void PrintResults(IEnumerable<SearchItem> items) => Debug.Log(string.Join(", ", items.Select(r => r.id))); var context = SearchService.CreateContext("asset", "a:examples class:property"); SearchService.Request(context, (c, items) => { PrintResults(items); c.Dispose(); }); }}
This example suppose you are indexing MonoScript with an index similar to this one: