Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Children

Selects all direct child elements of elements matching the previous rules.
Read time 1 minuteLast updated 11 days ago

Definition

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

name


classes

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

name


className

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");