Version: 2020.2
UXML elements reference
Styles and Unity style sheets

UQuery

UQuery provides a set of extension methods for retrieving elements from a visual tree. UQuery is based on JQuery or Linq, but UQuery is designed to limit dynamic memory allocation as much as possible. This allows for optimal performance on mobile platforms.

To use UQuery to retrieve elements, use the UQueryExtensions.Q or initialize a QueryBuilder with UQueryExtensions.Query.

For example, the following UQuery starts at the root and finds the first Button with the name foo:

root.Query<Button>("foo").First();

The following UQuery iterates, in the same group, on each Button named foo:

root.Query("foo").Children<Button>().ForEach(//do stuff);

  • 2018–11–02 Page amended
UXML elements reference
Styles and Unity style sheets
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961