QueryListBlockAttribute
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.
Read time 4 minutesLast updated 6 days ago
Definition
- Type: Class
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
- Inherits from: Attribute
[AttributeUsage(AttributeTargets.Class)]public class QueryListBlockAttribute : Attribute
Remarks
The following example shows how to display a custom list block for the filter block.
shaderExamples
[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) { var shaderIcon = EditorGUIUtility.Load("Shader Icon") as Texture2D; yield return new SearchProposition(category: null, "HDRP Decal", "Decal", icon: shaderIcon); yield return new SearchProposition(category: null, "URP Decal", "DecalURP", icon: shaderIcon); }}
Constructors
Constructor | Description |
|---|---|
| QueryListBlockAttribute(System.String,System.String,System.String,System.String) | Register a list block for a given filter. |
| QueryListBlockAttribute(System.String,System.String,System.String[],System.String) | Register a list block for a given filter. |
Properties
Property | Description |
|---|---|
| category | Category. |
| id | Filter id of the block. |
| ids | A set of IDs for which the list block will be displayed. |
| name | Displayed name of the block. |
| op | Default operator assigned to the filter when the value changes. |
| type | The list block type is used to get the the icon to be displayed instead of the block name. |