Class UQueryExtensions
UQuery is a set of extension methods allowing you to select individual or collection of visualElements inside a complex hierarchy.
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<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<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 |