Version: 2022.1

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; }