Children
Selects all direct child elements of elements matching the previous rules.
Read time 1 minuteLast updated 11 days ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
Children<T>(string, string[])
Selects all direct child elements of elements matching the previous rules.
public UQueryBuilder<T2> Children<T2>(string name = null, params string[] classes) where T2 : VisualElement
Parameters
Returns
Type | Description |
|---|---|
| UQueryBuilder<T> |
Examples
// Get all direct children of root that are buttons and have classes "health-button" or "unity-button".var buttons = root.Query().Children<Button>(classes: new[] { "health-button", "unity-button" });
Children<T>(string, string)
Selects all direct child elements of elements matching the previous rules.
public UQueryBuilder<T2> Children<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().Children<Button>(className: "health-button");