Skip to content
/ UQuery Public

๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ Unity GameObject query system

Notifications You must be signed in to change notification settings

0xF6/UQuery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

40 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฅ Unity Query ๐Ÿ”ฅ

Library for querying unity gameobject

OpenUPM

๐Ÿ“ฆ Install

openupm add com.ivysola.uquery

or paste this into manifest.json

"com.ivysola.uquery": "https://github.com/0xF6/UQuery.git?path=src/",

๐Ÿ“Œ Usage

/* 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'

๐Ÿงฌ Roadmap

  • 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

โš™๏ธ Unity Version Support

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.