-
Notifications
You must be signed in to change notification settings - Fork 7
UPath (Unity Path Language)
UPath gives ability to find a GameObject with more complex expression, with more complex dependencies.
First element will be define as root element and it should be active. All futher search is started from the element.
## Structure of expression:
Every expression is started from "//"
or "/"
, so it means that your next element is strictly child (if single slash) or child and grandchild (if double slash) of "Main Canvas" element.
Then you clarify name of GameObject that should be found next => "//nextGameObjectName". Note: you can clarify additional property of the GameObject with "[]"
.
If you don't specify any property for the GameObject, than the Driver will find first occurrence and further search will do against this GameObject.
## Types of search:
"//{name}"
- Find child or grandchild. Example: "//nameOfGameObject"
- find child or grandchild with name "nameOfGameObject"
"/{name}"
- Find child. Example: "/nameOfGameObject"
- find child with name "nameOfGameObject"
"/.."
- Take parent. Example: "/currentGameObject/.."
- take parent of GameObject with name "currentGameObject"
"/parent::{name}"
- Find parent. Exampe: "/parent::nameOfGameObject"
- take parent of GameObject with name "nameOfGameObject"
"/ancestor::{name}"
- Find parent or grandparent. Exampe: "/ancestor::nameOfGameObject"
- take parent or grandparent of GameObject with name "nameOfGameObject"
"/child::{name}"
- Find child. Example: "/child::nameOfGameObject"
- take child of GameObject with name "nameOfGameObject"
"/descendant::{name}"
- Find child or grandchild. Example: "/descendant::nameOfGameObject"
- take child or grandchild of GameObject with name "nameOfGameObject"
## Properties:
You can clarify additional property of searched GameObject with "[]"
after the name of the gameObject.
[number] - index of searched GameObject. Example: "/gameObjectName[1]"
- will find all gameObjects with name "gameObjectName" and take gameObject with index 1 in a collection.
[axe::{name}] - gameObject should have relation wiith gameObject in property according to Axe (parent, child, ancestor, descendant). Example: "/gameObjectName[parent::parentName]"
- will find gameObjects with name "gameObjectName" and take first who has parent with name "parentName"t with name "parentName"