Unity 6.3
0 онлайн 79 гостей 3 в системе
Вход

SearchIndexer.GetDocument

Declaration

public Search.SearchDocument GetDocument(int index);

Параметры

Параметр Описание
индекс Действительный индекс документа, к которому требуется доступ.

Возвращаемое значение

SearchDocument Индексированный поисковый документ.

Описание

Возвращает поиск документа по его индексу.

using UnityEditor;
using UnityEditor.Search;
using UnityEngine;

static class Example_SearchIndexer_GetDocument
{
    [MenuItem("Examples/SearchIndexer/GetDocument")]
    public static void Run()
    {
        var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject());
        si.Start();
        si.AddDocument("document 1");
        si.AddDocument("document 2");
        si.AddDocument("document 3");
        si.Finish(() =>
        {
            // Enumerate all documents
            for (int di = 0; di < si.documentCount; ++di)
            {
                var doc = si.GetDocument(di);
                Debug.Assert(doc.id.StartsWith("document"));
                Debug.Log(doc.id);
            }

            // Dispose of the SearchIndexer when you are done with it.
            si.Dispose();
        });
    }
}