docs.unity3d.com
    Show / Hide Table of Contents

    Class UQueryExtensions

    UQuery is a set of extension methods allowing you to select individual or collection of visualElements inside a complex hierarchy.

    Inheritance
    Object
    UQueryExtensions
    Namespace: UnityEngine.UIElements
    Syntax
    public static class UQueryExtensions : object

    Methods

    Q(VisualElement, String, String)

    Convenience overload, shorthand for Query<T>.Build().First().

    Declaration
    public static VisualElement Q(this VisualElement e, string name = null, string className = null)
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String className

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    VisualElement

    The first element matching all the criteria, or null if none was found.

    Q(VisualElement, String, String[])

    Convenience overload, shorthand for Query<T>.Build().First().

    Declaration
    public static VisualElement Q(this VisualElement e, string name = null, params string[] classes)
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String[] classes

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    VisualElement

    The first element matching all the criteria, or null if none was found.

    Q<T>(VisualElement, String, String)

    Convenience overload, shorthand for Query&lt;T>.Build().First().

    Declaration
    public static T Q<T>(this VisualElement e, string name = null, string className = null)
        where T : VisualElement
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String className

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    T

    The first element matching all the criteria, or null if none was found.

    Type Parameters
    Name Description
    T

    Q<T>(VisualElement, String, String[])

    Convenience overload, shorthand for Query&lt;T>.Build().First().

    Declaration
    public static T Q<T>(this VisualElement e, string name = null, params string[] classes)
        where T : VisualElement
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String[] classes

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    T

    The first element matching all the criteria, or null if none was found.

    Type Parameters
    Name Description
    T

    Query(VisualElement)

    Initializes a QueryBuilder with the specified selection rules.

    Declaration
    public static UQueryBuilder<VisualElement> Query(this VisualElement e)
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    Returns
    Type Description
    UQueryBuilder<VisualElement>

    QueryBuilder configured with the associated selection rules.

    Query(VisualElement, String, String)

    Initializes a QueryBuilder with the specified selection rules.

    Declaration
    public static UQueryBuilder<VisualElement> Query(this VisualElement e, string name = null, string className = null)
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String className

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    UQueryBuilder<VisualElement>

    QueryBuilder configured with the associated selection rules.

    Query(VisualElement, String, String[])

    Initializes a QueryBuilder with the specified selection rules.

    Declaration
    public static UQueryBuilder<VisualElement> Query(this VisualElement e, string name = null, params string[] classes)
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String[] classes

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    UQueryBuilder<VisualElement>

    QueryBuilder configured with the associated selection rules.

    Query<T>(VisualElement, String, String)

    Initializes a QueryBuilder with the specified selection rules.

    Declaration
    public static UQueryBuilder<T> Query<T>(this VisualElement e, string name = null, string className = null)
        where T : VisualElement
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String className

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    UQueryBuilder<T>

    QueryBuilder configured with the associated selection rules.

    Type Parameters
    Name Description
    T

    Query<T>(VisualElement, String, String[])

    Initializes a QueryBuilder with the specified selection rules.

    Declaration
    public static UQueryBuilder<T> Query<T>(this VisualElement e, string name = null, params string[] classes)
        where T : VisualElement
    Parameters
    Type Name Description
    VisualElement e

    Root VisualElement on which the selector will be applied.

    String name

    If specified, will select elements with this name.

    String[] classes

    If specified, will select elements with the given class (not to be confused with Type).

    Returns
    Type Description
    UQueryBuilder<T>

    QueryBuilder configured with the associated selection rules.

    Type Parameters
    Name Description
    T
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023