Descendents
Selects all elements, recursively, that are descendants of currently matching ancestors.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
Descendents<T>(string, string[])
Selects all elements, recursively, that are descendants of currently matching ancestors.
public UQueryBuilder<T2> Descendents<T2>(string name = null, params string[] classNames) where T2 : VisualElement
Parameters
Returns
Type | Description |
|---|---|
| UQueryBuilder<T> |
Examples
// Get all children, recursively, of root that are buttons and have classes "health-button" or "unity-button".var buttons = root.Query().Descendents<Button>(classNames: new[] { "health-button", "unity-button" });
Descendents<T>(string, string)
Selects all elements, recursively, that are descendants of currently matching ancestors.
public UQueryBuilder<T2> Descendents<T2>(string name = null, string classname = null) where T2 : VisualElement
Parameters
Returns
Type | Description |
|---|---|
| UQueryBuilder<T> |
Examples
// Get all children, recursively, of root that are buttons and have class "health-button".var buttons = root.Query().Descendents<Button>(classname: "health-button");
Descendents<T>(UniqueStyleString)
Selects all elements, recursively, that are descendants of currently matching ancestors.
public UQueryBuilder<T2> Descendents<T2>(UniqueStyleString classname) where T2 : VisualElement
Parameters
Returns
Type | Description |
|---|---|
| UQueryBuilder<T> |
Examples
// Get all children, recursively, of root that are buttons and have class "health-button".var buttons = root.Query().Descendents<Button>(classname: "health-button");
Descendents<T>(string, UniqueStyleString)
Selects all elements, recursively, that are descendants of currently matching ancestors.
public UQueryBuilder<T2> Descendents<T2>(string name, UniqueStyleString classname) where T2 : VisualElement
Parameters
Returns
Type | Description |
|---|---|
| UQueryBuilder<T> |
Examples
// Get all children, recursively, of root that are buttons and have class "health-button".var buttons = root.Query().Descendents<Button>(classname: "health-button");