Version: 2022.3
LanguageEnglish
  • C#

QueryListBlockAttribute

class in UnityEditor.Search

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

This attribute can be used on a class deriving from QueryListBlock to display in query builder mode a special block that will propose a fixed set of values when clicked.

The following example shows how to display a custom list block for the shader filter block.

[QueryListBlock("Decal", "Shader", "shader")]
class ShaderDecalBlockList : QueryListBlock
{
    public ShaderDecalBlockList(IQuerySource source, string id, string value, QueryListBlockAttribute attr)
        : base(source, id, value, attr)
    {
    }

    public override IEnumerable<SearchProposition> GetPropositions(SearchPropositionFlags flags = SearchPropositionFlags.None)
    {
        yield return new SearchProposition(category: null, "HDRP Decal", "Decal", icon: GetShaderIcon() as Texture2D);
        yield return new SearchProposition(category: null, "URP Decal", "DecalURP", icon: GetShaderIcon() as Texture2D);
    }
}

Properties

categoryCategory.
idFilter id of the block.
idsA set of IDs for which the list block will be displayed.
nameDisplayed name of the block.
opDefault operator assigned to the filter when the value changes.
typeThe list block type is used to get the the icon to be displayed instead of the block name.

Constructors

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