This is a feedback thread! First off, I want to say that I appreciate the ambition of the new unity search package. The idea of having a full-powered query language is fantastic. As someone who’s written a lot of SQL, I’ve been very excited for the premise. But the implementation is pretty buggy. That means that even as someone very experienced with query languages, I’m never sure if my query is wrong, or I’m just hitting another bug!
Documentation
First off, the documentation for the search language is.. extremely weird. There’s tons of documentation on extremely advanced queries, filters, search providers, etc. This is great, but not all that useful? I really struggle to find information on the basic language. I still don’t know:
- What is the syntax of a basic query? Does a space represent OR or AND?
- When should I use = or : after an operator?
- Do I always need to specify a search provider? What is the default if not?
- Can I combine search providers? ie.
p: h: or do I only get one?
- Does using a different search provider change the subsequent syntax?
- Which operators are valid for which search providers?
path is used for hierarchy, but dir is used for the project.
- What is the syntax of each operator? What values can i pass to
dir? To name? Do they take backslashes on Windows? Etc.
- What are the valid values for abstract operators like
t:?
- When do I need to perform a re-index, or should it maintain that automatically?
- How can I set it up by default to effectively just ‘index everything?’
Here is the documentation page on “Using Search”. There’s only a small section on how to write searches:
Those two links lead to far too advanced information. There’s another page in the sidebar called “Search Operators”, which does go over some basic syntax, but is extremely limited, with very few examples.
I’m so confused by this because it’s clear there’s a great search language here! It’s a huge feature that sets Unity apart from Unreal – it should be front and center with incredible documentation!
Bugs:
Every time I try to use the unity search package, I constantly hit several issues:
- Correct queries simply return nothing at all. For example “t:Mesh” will return results in the File tab, but the project tab will show “No Results”.
- Sometimes ‘=’ is interchangeable with ‘:’ and sometimes it’s not. For example,
name=MyName and name:MyName both work. But dir=MyDirectory does not while dir:MyDirectory does.
- Bug: On that note, using the Query Builder seems to inject the wrong query for ‘dir’. The directory name filter translates to “dir=directoryname” rather than the correct “dir:directoryname”.
- The settings button in the bottom right cannot be clicked because it overlaps the ‘resize window’ cursor hover spot.
- What does “Show more results” mean? Currently you always have to click it, because what if your asset is being hidden. Is it doing a re-index? Is it searching hidden folders? Who knows!
- Sometimes icons for prefabs will show up, and sometimes they won’t.
Overall, this leaves me constantly questioning whether my search query is wrong, or whether the search package is simply broken.
Thanks for reading – Overall I like the direction this is all going in, but I really hope these bugs can be tidied up.
4 Likes
Hi @JohnPontoco ,
Thanks for the feedback. I will try to answers all your questions.
-
Syntax for a basic query is “any string of text”. Depending on SearchProviders We will try to match this string against the name of the items. Space between words represents a boolean AND (Unity - Manual: Search query operators).
-
The operator = will perform an exact match against the provided value. The operator “:” means “contains” and will perform a "partial match.
t:Mesh will match MeshRenderer and MeshFilter
t=Texture will only match Texture (and not Texture2D).
-
By default, if your query doesn’t contain an explicit searchProviders, the query is run on all “general search providers”: scene, asset, settings, menu.
-
You can only use a single “explicit” provider. p:t:Mesh or h:intensity=1
-
Each provider has its own list of filters. So this means if you run the GENERAL query is:prefab the Menu provider and the Settings Provider won’t yield anything since they do not know anything about this filter.
-
Scene provider filters: Unity - Manual: Search the current Scene
-
Asset provider filters: Unity - Manual: Additional Search filters
-
That said, the Visual Query builder will only suggest propositions that make sense in the context of your query.
-
dir vs path: I will admit we do not have ways to “force” a specific syntax. By default dir and path should use slash. Basically anything you can right click on and select “Copy path” will work with dir and path.
-
dir= will match an exact path within your project
-
dir: will match something against any part of the path of an asset.
-
t: type can be a Component type or an asset type. The QueryBuilder will help you fill any of these type names.
-
Asset indexation should be fully automatic. First time you open the Search window in a project a full indexation will be done. Then each time assets changes, and incremental indexation of only the changed assets will be performed.
-
By default everything is indexed. You can tweak indexation in the Index Manager (Window → Search → Index Manager). If you know folders that shouldn’t be indexed, add those to Excludes. If you have a LOT of assets and do not want to use Search By Property, feel free to uncheck Properties option.
-
You are right that the onboarding section of the doc should be improved.
About the Bugs section:
-
The “tab” you select in the view filters results by providers. So if t:Mesh doesn’t yield something in a specific tabs it means this tabs doesn’t know about this filter. The File tab shouldn’t yield anything with t:Mesh since only matching against assset name will be performed. if the Project tab doesn’t yield anything for t:mesh it either means indexation is not done or you do not have an asset (i.e prefab) with a component starting with the name Mesh.
-
QueryBuilder and dir. You are right that we should probably use the : operator by default.
-
Show More: I will admit this is a tricky one. This is a switch that is passed to the various SearchProviders to tell them to return “more potentially imprecise results” from the query. This is probably bad UX and I am sorry about that 
-
Icons: the previews/thumbnails/icons are generated when needed. It uses a similar system as the Project Browser. If icons are not available this is a bug.
-
Package search: this is a tricky one. Some users do not like package results to “pollute their search” because they only use “3rd party package for their functionalities and do not care about their assets”. Some users develop a LOT of content with packages. So there is no silver bullet solution.
If you want to search and get package results using the Asset Provider:
- Ensure Indexation will happened in packages. And the Asset provider will yield values in packages.
Again, thanks for your feedback!
Sebastien
Thanks for the info!
Oh wow. This is exactly what I needed to know, I don’t think I would have figured that out, haha! It’s confusing in part because colons are also used for providers.
Ah, interesting. The fact that t:Mesh searches for prefabs with components that contain “Mesh” is also unintuitive. Coming from the previous Unity search, where t:Mesh would return Objects that are of type Mesh.
Just to check my understanding, if I want to find all Meshes in the directory Assets/foo I would use the query:
dir:foo t:Mesh
Although, would that also return prefabs with MeshRenderer/MeshFilter on them? I suppose:
dir:foo t=Mesh
would be better? Which should be fine as long there isn’t a Component type with the same name as an Asset type.
A lot of operators aren’t valid for certain providers, but it’d be nice to flag those with a warning if you try to view that pane. That would have also helped when I was trying to use path operators in the Project tab, and was very confused.
Also, it’d be nice to merge some of them, like dir/path.
Lastly it’d be nice to have a formal operator documentation page. Something like:
| Operator |
Providers |
Description |
Notes |
| path |
Hierarchy (h:) |
Search the hierarchy for a gameobject with this name or path. |
Can use ‘=’ for exact match. Use ‘:’ for ‘contains’. |
| dir |
Project (p:), Files (f:) |
Search for a file with this path. |
Can use ‘=’ for exact match. Use ‘:’ for ‘contains’. |
| t |
Hierarchy (h:), Project (p:) |
Matches an Asset of type T, or a GameObject with component of type T, or a Prefab Asset with component of type T. |
Can use ‘=’ for exact match. Use ‘:’ for ‘contains’. |
|
|
|
|
|
|
|
|
- About dir and t :
dir:assets t=Mesh → All assets in folder who are Mesh
dir:assets t:Mesh → All assets in folder who matches a type starting with the string “Mesh” (including components of prefab)
We where told that the fact the our type filter matches prefab component was really useful especially in the Advance Object Picker.
- We have some error validation that can indicate if a filter is incomplete (in this case missing a value):
I thought we would validate filter validity for provider but it doesn’t seem to do a proper validation. I will need to investigate.
- I agree that the doc could be improved. I personnaly would prefer a single page with all filters for all providers. But our doc writer felt it was too much information. I have written a bunch of articles on all search workflows: wiki. At some point I even wrote a cheatsheet for all search providers. That cheat sheet might be a bit out of date though.
If you want to be “guided” by the Search Window when writing a query I suggest you use the Visual QueryBuilder:
Let’s say I want to find all textures that are 128x128:
0- This is everything I can search for:
1- Double click on Project query block. Then click the + button to see all valid Filters for Project:
2- Select Properties → Texture 2D:
3- Setup the proper filter operator and value:
4- Add height:
When happy press the diskette icon and save this as a local query in your project:
This document has some good query examples showcasing some of the lesser known query filters.
Yes! I do like this. I use the advanced object picker and it’s very nice. 
This is exactly the information I need though! It’s the difference between reference and documentation. The documentation is alright, but there’s currently no reference material!
That cheatsheat is phenomenal, and extremely helpful. That sort of thing is what I was looking for when I was wondering what the ‘syntax’ was. Thanks!
I’ve hit another bug, unless I’m doing something wrong.
I have an asset that is created within a ScriptedImporter. It’s a GameObject named Flour_Plated with a component of type ItemAuthoring.
This is found correctly using the Quick Search window, with the query t:ItemAuthoring Item_Plated:
However, when using the “Select Item” window, the exact same query returns nothing!
It finds other Prefabs with ItemAuthoring, just not the ones created by the ScriptedImporter.
Am I doing something wrong, or is this a bug? I can’t see why the same query would return different results.
This new search is awful.
Like how do i limit it to search to only the prefabs that are solid blue actual prefabs and not model prefabs…
Is there a command to select every alternate row in the sequence?
the new search is fucking shite
Thanks for your candid feedback @altair2020 ,
-
t:prefab matches fbx if they contains model.
-
If you want to filter only for prefab file you have multiple choices:
- you can search by file extension *.prefab
- you can search regular prefab:
-
t:Material will also match fbx files if they contain materials. You can remove “nested” object from a query using:
- There are no easy way to select 1 out of 2 items in the list. This is not a workflow that is supported in any Unity tool using a list (to my knowledge).
What would you prefer in terms of behavior if you type: t:prefab ? You would prefer that it only matches .prefab file?
Which version of Unity are you using?
I checked your screenshot again and I want to add more context:
- Your screen shot shows the query t:prefab, but it shows that the “Hierarchy” tab is selected. This means you have prefabs and models in your scene (hierarchy tab shows object in your current scene).
Similar to this screenshot from my project:
Notice that the Scene Hierarchy window doesn’t return anything for t:prefab
The new Hierarchy Window will return the same results for the t:prefab query:
You can enable the HierarchyWindow in preference:
If you select the Project tab you will only get actual prefab on disk.
Notice that if you know you want to search for Asset (and not objects in scene) you can prefix your query with an area.