Hi all
I’m trying to use ( and understand how it works ) the unity search inside editor.
It appears to me really weird and i’m unable to use it properly.
In this picture:
I have a scene hierarchy with 2 assets contained in a topmost GameObject ( a blend file ).
In those 2 assets, i have some children like candle flames and lights.
What i want is to select ONLY the point lights that are children of the Auberge1 GameObject and NOT the point lights that are children of the Marchand GameObject.
Could anyone please give me a clue for achieving this ?
I’ve been trying since now 3 hours and really get bored.
For now i’ll select those lights by hand ( or maybe write my own script that works )
many thanks !!!
Happy unitying !
Hi @pitibonom ,
Just to clarify you want to select those objects or you want to filter the Hierarchy so only those objects are visible? The SearchField at the top of the Hierarchy will filter out objects but won’t affect selection.
The base search in hierarchy allows to filter objects according to their types or ids (mostly). This means if you do:
t:Light you will get only objects with the Light Component displayed in the Hierarchy.
in your cases, you want to see Point Light that have a specific object as parent? Unfortunately there is no filter allowing you to do this. parent:<name of a node>
would be ideal but this is not something we support for now.
I thought more aboiut your use case and we have a filter that could help. The path:<hierarchypath>
filter can be use to filter all objects under a certain path
Ex: if you use the :
operator (which means “contains”)
By opposition using the =
operator which performs exact match would show:
By this logic if your query is:
- Give me all Light with the type PointLight that are children of Auberge1 you could do something like:
h: t:Light #Light.m_type=Point path:"Auberge1"
Now I have run these queries into the SearchWindow (press Ctrl + K) to open this window. The SearchWindow allows to search antything in your project: assets, hierarchy objects, menu, settings and much more. It contains a bunch more filters than the legacy hierarchy like the path:
filter.
That said, you can configure your Hierarchy to use the Advance Search:
- Edit → PRefrences → Search
- Ensure the Scene Search Engine is set to Advanced
Then the same query that you can run in the SearchWindow:
Can be run in the Hierarchy: