Version: 2022.2
언어: 한국어
public Search.SearchDocument GetDocument (int index);

파라미터

index Valid index of the document to access.

반환

SearchDocument Indexed search document.

설명

Returns a search document by its index.

using UnityEditor;
using UnityEditor.Search;
using UnityEngine;

static class Example_SearchIndexer_GetDocument
{
    [MenuItem("Examples/SearchIndexer/GetDocument")]
    public static void Run()
    {
        var si = new SearchIndexer();
        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);
            }
        });
    }
}