Version: 2022.3

SearchSelectorAttribute

class in UnityEditor.Search

切换到手册

描述

Search selector attribute used to define how a custom value can be selected from a search item.

Here's an example to select the number of line of code of text assets. > select{p: *.cs, @path, @loc}.

[SearchSelector("loc", provider: "asset")]
static object SelectLineOfCode(SearchSelectorArgs args)
{
    TextAsset textAsset = args.current.ToObject<TextAsset>();
    if (textAsset)
        return textAsset.text.Split('\n').Length;

return null; }

变量

cacheableSet the cacheable property if you do not want the search backend to pull cached values from the property database.