Version: 2021.3
언어: 한국어
public static Search.SearchContext CreateContext (string searchText);
public static Search.SearchContext CreateContext (string searchText, Search.SearchFlags flags);
public static Search.SearchContext CreateContext (Search.SearchProvider provider, string searchText);
public static Search.SearchContext CreateContext (string providerId, string searchText, Search.SearchFlags flags);
public static Search.SearchContext CreateContext (IEnumerable<string> providerIds, string searchText, Search.SearchFlags flags);
public static Search.SearchContext CreateContext (IEnumerable<SearchProvider> providers, string searchText, Search.SearchFlags flags);

파라미터

searchText Search Query.
provider Search provider (This search provider does not need to be active or registered).
providerId Unique search provider ID string (i.e. asset, scene, find, etc.)
providerIds List of search provider IDs.
providers List of search providers.
flags Options defining how the query is performed.

반환

SearchContext Returns a new SearchContext.

설명

Creates context from a list of search provider IDs.

using UnityEditor;
using UnityEditor.Search;
using UnityEngine;

static class Example_SearchService_CreateContext
{
    [MenuItem("Examples/SearchService/CreateContext")]
    public static void Run()
    {
        using var searchContext = SearchService.CreateContext("scene", "camera");
        using var results = SearchService.Request(searchContext);
        {
            foreach (var label in results.Select(r => r.GetLabel(searchContext)))
                Debug.Log(label);
        }
    }
}


Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961