openupm add com.ivysola.uquery
or paste this into manifest.json
"com.ivysola.uquery": "https://github.com/0xF6/UQuery.git?path=src/",
/* graph of game objects
%scene_root% |
- Canvas |
- Layout |
- Header |
- Title | <UIText>
*/
var result = UQuery.SelectByPath<UIText>("Canvas>Layout>Header>Title[UIText]");
result // UIText component
var result = UQuery.SelectByPath<GameObject>("Canvas>Layout>ButtonGroup");
result // GameObject 'ButtonGroup'
/*
%root% |
- Canvas |
- Layout |
- Header |
- Title1
- Header |
- Title2
- Header |
- Title3
- Header |
- Title4
*/
var result = UQuery.SelectByPath<UIText>("Canvas>Layout>Header:(2)>Title3");
result // GameObject 'Title3'
- Light Documentation
- Samples
- Validate IL2CPP Target
- Directives for MORELINQ & UNITY_LINQ
- Support querying by tag\layout (?)
- Aliases in Query Path
- Strong validation path format
- Additional exceptions types
- Query cache system
- Access child (same names) by index
So, the code of this library uses C# 8.0
version, upm puts the source code in its pure form, and unity compiles it with its internal compiler - so the minimum supported version of the package is 2020.2
.
if you want to use this library on older versions of the engine, the compiled library (built in Plugins
) can also work on version 2019.*
or you can use C# Custom compiler for set-up your 2019.* unity to you to compile C# 8.0 in packages asmdef.