GetChildren Method

GetChildren<TElement>(VisualElement, List<TElement>, Func<TElement, Boolean>)

Get the direct children of a VisualElement filtered by type and an optional filter delegate. It stores them in a List parameter to avoid memory allocations.

Declaration
public static void GetChildren<TElement>(this VisualElement ve, List<TElement> results, Func<TElement, bool> filter = null)
    where TElement : VisualElement
Parameters
VisualElement ve

The parent element

List<TElement> results

A list to store the results.

Func<TElement, Boolean> filter

An optional filter callback.

Type Parameters
TElement

The type of the child elements

GetChildren<TElement>(VisualElement.Hierarchy, List<TElement>, Func<TElement, Boolean>)

Get the direct children of a VisualElement.Hierarchy filtered by type and an optional filter delegate. It stores them in a List parameter to avoid memory allocations.

Declaration
public static void GetChildren<TElement>(this VisualElement.Hierarchy hierarchy, List<TElement> results, Func<TElement, bool> filter = null)
    where TElement : VisualElement
Parameters
VisualElement.Hierarchy hierarchy

The parent hierarchy

List<TElement> results

A List to store the results

Func<TElement, Boolean> filter

An optional filter callback

Type Parameters
TElement

The type of the child elements