Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Descendents

Selects all elements, recursively, that are descendants of currently matching ancestors.
Read time 1 minuteLast updated 12 days ago

Definition

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

name


classNames

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

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().Descendents<Button>(classname: "health-button");