A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Editor Workflows' started by benoitd_unity, Feb 26, 2019.
Yes you are right. We will put something in place for this.
Yes I have noticed that issue. I wonder if it has something to do with pressing ALT? Is your shortcut bound using ALT? We also added contextual search, so in example you could bind it to CTRL+F and if the focused is on the Project Browser, it will open Quick Search and only enable the asset search provider. Maybe binding CTRL+F will prevent the textfield from eating all inputs. I'll make a few test today around this and see if it could be improved.
2018.3/4, so no rebinds for me.
Yes the second one can still be printed. I asked the scripting team and what happens is that by the time the exception gets thrown, a domain reload also occurs and cancel the current domain code execution therefore ignoring the try/catch statement to not print the error. That said, other than being annoying the exception should not cause anything else. I still have to find a better solution.
Do you get it that often? How big is your project? On my side I didn't get it that often, unless I was spamming the Play/Stop button while the quick search window was docked.
Ahh shoot We really need to find a better shortcut that doesn't require ALT (maybe at least for version 2018.3/4). Let me think about something and I'll get back to you.
Semi-often. Once every two or three times I enter or exit play mode? Something like that.
Project is mediumish (10gb assets folder), but we're probably an outlier in number of assemblies (101)
Also got a warning that indexing was aborted "probably due to domain reload". Yes, yes it was. You don't need to warn us about that.
How near zero is the chance of convincing the release management team to allow backporting shortcuts management to 2018.4?
Ok we'll remove the warning.
I can ask around, but since 2018.4 is now LTS I wouldn't expect that to happen. The shortcut manager required a pretty big refactoring of some low level systems, so I doubt we would take the risk to backport it to 2018.4 at this stage.
Yeah, I assumed as much. It's just a downer that a lot of the packages you will be shipping will probably rely on it for setting up shortcuts, so we might end up with package authors avoiding LTS for that reason.
Version 1.2.1-preview published with some minor fixes.
I just found out about this and installed it - this is really great! Great work @jonathans42 and @sebastienp_unity (hello btw - it's been a while!
Hi Sam, great to hear from you! It's a new tool still looking for feedback. Do not hesitate to let us know what works and what doesn't. The SearchProvider API is available too if you have some good idea to create a new provider for one of your tool.
Have a great day!
Guys, why did your remove asset type filter in 1.2.1?
Now it`s a complete mess, if you always want to just search for prefabs, or scriptable objects, but hundreds of models, shaders and materials are showing you don`t care about, search becomes really unusable.
Doesn't show up in Unity 2019.3.0a2
You can specify the filter yourself. If you are using the new indexed search you can simplify add the keyword "prefab" or through the asset database API by adding "trefab". With the new indexed search you should be able to type just a few characters to filter out additional stuff. The issue with the previous filter list was that it was incomplete and causing searches to be incomplete in many cases. When you do your searches try this: "<something> <type extension>" you'll get what you are looking for quickly. Make sure to enable the indexed search in the Quick Search settings.
It will in 2019.3.0a6 when released in the hub or you can always find it as a preview package in the Package Manager.
What is the fastest way to search scriptable objects only?
Please keep in mind, many big projects have entire databases from scriptable objects (e.g. Crowfall MMO as an example) and searching for them should be fast, so typing "<asset name> scriptableobject" would be super slow and annoying
Usually you do not need to type the entire extension, but you are right if that all your scriptable object type ends with .asset it would be hard to filter them, but the previous list wasn't showing all scriptable object types anyway.
That said, I hear your feedback and we'll see how we can improve that in the next version. Meanwhile, enable the asset indexed search and try different pattern, like MSF, to match things like MySuperFile, etc. I am sure you'll quickly get how to form your search query to get quickly to the file you are looking for.
Would you like me to provide you a custom SearchProvider example (c# script) that only search for prefab or some other type that you could tweak for your specific need?
You could simply drop that script in your project or in another package that depends on com.unity.quicksearch and tweak it. You'll see, it is pretty simple to make a search provider for specific needs.
Let me know.
As soon as v1.2.2 is released you'll be able to write your own asset type indexer like so: https://gist.github.com/jschmidt42/0aa91bbb39f52fb5ba74ce75911769c6
Thank you, I will certainly try that!
New version 1.2.2
- Add more performance, productivity and fun!
- Add fuzzy search to scene objects search provider.
- [API] Add Search.customDescriptionFormatter to allow a search provider to indicate that the item description was already done and should not be done generically (used by the scene object search provider fuzzy search).
- [API] Add SearchProvider.isExplicitProvider to mark a provider as explicit. An explicit provider only list search result if the the search query start with its filter id. In example, # will get into the calculator search provider and # will only return static method APIs.
- [API] Expose the SearchIndexer API to easily add new search provider with indexed data.
- [UX] Add ... to long search item description and show the entire description as a tooltip.
- [UX] Add more tooltips to some controls to indicate more advance features.
- [UX] Allow the user to change the default action to be executed for search item with multiple actions.
- [UX] Make the asset indexed search the default search for the asset search provider.
- [UX] Make the Quick Search window default size larger.
- [UX] Separate regular search providers from explicit search providers in the filter popup window.
I'm impressed with how much the development of this tool has progressed.
At first I thought it would never be as good as my own stuff, but I'm glad to have been proved wrong.
Really appreciate the development and communication going on here and I hope to see more of Unity going this route.
Thanks a lot!
New version 1.2.3
- Add a new help search provider to guide the user how to use other search providers (type ? to get a list of search help items).
- [UX] Draw some nice up and down arrows to order the search provider priority.
- [UX] Add a status bar to give some context to the user what is going on and what is filtered or not.
- [UX] Add a Reset Priorities button in the Settings window to restore all default search provider priorities if messed up for whatever reason.
- [FIX] Fix the ordering of search provider priorities in the Settings window.
- [FIX] Fix the order of explicit providers in the filter popup window.
- [FIX] Fix a rare exception when the SearchIndexer is trying to write to the temporary index DB.
- [API] Add `SearchAction.closeWindowAfterExecution` to indicate if the window should be closed after executing an action. Now an action can append to the search text and show additional search items.
- [API] Add `ISearchView` interface for `SearchContext.searchView` to give access to some functionalities of the Quick Search host window.
If anyone of you have tried the Quick Search API to add new search provider or search actions, please let us know what worked, what is missing and what could be improved.
Also we'll probably moved the source code to https://github.com/Unity-Technologies so everyone can contribute if they wish too.
I'm enjoying the Quicksearch feature, but I wish it could be a little more intelligent. I'm often using it to open up and edit some prefabs which share the same name with corresponding .fbx files, folders, etc. If I type the name and open the prefab for editing 3 times in a row, maybe the Quicksearch window should consistently put the prefab at the top of the list of results? Instead, the order it returns is seemingly random
Hi, are you using the latest version 1.2.3? Usually the recently used items should show first for the same provider. Do you use the global shortcut to open the quick search or do you use the shortcut to open Quick Search only for assets, i.e. Alt+Shift+O? As of now, contextual search do not persist settings, such as recently used items. Only the global search persist preferences through multiple session.
i just updated to 1.2.3 today. I use Alt+' to open the search...
Ok then the item you've selected once should show first with that new version. Let me know if that is still not the case and we'll fix it.
Hey, could you make the Unity.QuickSearch.FuzzySearch public? I'm creating a provider and don't want to have to modify the package itself, just extend it.
I also have 3 (other) feature requests:
1. A GUID provider. I use this often when I don't know what Unity is talking about in a diff or merge. It's useful and we can add it as a general provider safely, since we only have to actually hit it when the input is 32 chars long (then we just feed it to AssetDatabase.GUIDToAssetPath and see what it gives us).
2. When the GameObject's name is displayed in the search, it would be useful to include the scene name as well.
I made a gist with the utility I use to format my GameObject's (and components) hierarchy path.
Feel free to use and modify it in any way.
This is particularly useful when working on heavy multi-scene setups. For example, we have a bunch of objects named "Mechanics". But we want one on a specific scene to be selected. Without the scene name, we have to test each one.
Here's a comparison
3. In the scene hierarchy search box, I can use the t:SomeComponent to search for all GameObjects that have the SomeComponent component. On my own QuickSearch-like tool, I also added this and it's very useful. This is actually the provider I'm thinking of adding here.
I'm rethinking it a bit because I read the SceneObjectsProvider source and I would have to duplicate a lot of what it does.
It would help if I could access SceneObectsProvider.gods (I think this stands for GameObject Description?), so that I wouldn't have to create another array with the GameObjects (and wouldn't have to parse their names again). But that might introduce ordering issues.
What do you think? If we're creating a provider for scene gameObjects, should we duplicate what SceneObjectsProvider does? Or add another layer of abstraction to providers so we can get some info from this abstraction that we can use on other providers?
For example, most providers that want to deal with scene GameObject will end up doing
Here's an example of my component search
Normal search (no matches)
This is fairly heavy to have partial matching, since we need to build an index with all components and their names. So, it's probably best to have only direct querying. Like, t:ghosty should match t:Ghosty, like the scene search does. But t:ghost should not. This avoids us to have to build a possibly large index by finding all components.
All great ideas!
We'll make the fuzzy search public, we'll add a guid provider (super great idea), we'll add the sub-scene name in the scene object search item description and for #3 we'll have too see, but we'll try something.
There you go for the GUID search (simple copy/paste a GUID in the search box).
We added a sub-filter (e.g. guid) so you can disable it if someone thinks it slow down the search.
SugoiDev what do you think of this formatting?
Label: <transform path> (instance ID)
Description: <sub scene name/prefab path>/<transform path> (fuzzy score)
I also added a new action to open the corresponding container asset. It will select/focus the asset in the project browser.
I added prefab game object instance preview as well:
Oh yeah, that looks awesome!
I'll test it as soon as it lands.
Thanks for such crazy fast response (and action).
I have a bit different case that Option(Alt) + Shift + O would stop working after a certain event, and from that point on it requires 1 click on any docked window to allow you to press the shortcut once. The only way to fix is restarting editor then it works fine until a "certain event" occur. I have a repro that Alt doesn't work which I think related to this problem, but it was flagged as low priority defect and Won't Fix. https://fogbugz.unity3d.com/default.asp?1157429_3t3sf1kt96j23b12
How would I go about implementing a Provider to search for specific text within a field of a certain asset type? (all my game's text is stored in SOs) ?
Ok interesting, I'll take a look into that.
You can take a look at https://gist.github.com/jschmidt42/0aa91bbb39f52fb5ba74ce75911769c6
The idea is too fetch from the asset database all interested assets and then query the info you want and store them in an index for fast search. Unfortunately querying the asset database needs to be done in the main thread. If you are up to it, you can hack the system and go poke directly in the associated meta file using the file system API and index what you need.
Hi Aaron, I was able to repro your issue and a fix will be available in version 1.2.4 today or tomorrow.
Version 1.2.4-preview is now available. Special thanks to @SugoiDev for some great suggestions.
- [UX] Add support to search asset by its GUID.
- [UX] Add scene objects root container asset information.
- [UX] Add prefab instance preview for scene objects
- [FIX] Improve search provider filtering
- [FIX] Fix recently used item persistence
- [FIX] Add an active loop while installing and removing packages to prevent any race conditions.
Just noticed the Utils.GetEditorMainWindowPos is not very efficient.
It adds about 1 second to the time it takes to show the QuickSearch window on my project.
The reason being that it iterates over all types, which doesn't scale very well when we have many types.
We can try using the UnityEditor.TypeCache, with 2019.2+
Scanning the domain
Using the UntiyEditor.TypeCache
Feels much faster!
I just replaced the start o the GetEditorMainWindowPos method
internal static Rect GetEditorMainWindowPos()
var containerWinType = UnityEditor.TypeCache.GetTypesDerivedFrom<ScriptableObject>().FirstOrDefault(t => t.Name == "ContainerWindow");
but you can probably integrate it in the GetAllDerivedTypes method for better reuse.
You can also look at using UnityEditor.TypeCache.GetMethodsWithAttribute with your GetAllMethodsWithAttribute method.
Wow ok! Integrating that in the next release for sure!
I am also thinking of adding a public API directly in Unity Editor for GetEditorMainWindowPos instead of using reflection like we are doing now. it would be much faster in call cases.
I'm sometimes getting an exception:
Rethrow as InvalidOperationException: Failed to compare two elements in the array.
Not sure what is causing it (never got it when I had a debugger attached).
I'm attaching 3 logs with stacktrace + source position of when it happened.
Oh yeah, that would be much better!
I tend to avoid reflection as much as possible, in particular anything that iterates over the assemblies.
At first it costs nothing, but I got some strong kicks when I got a project with over 100k types (lots of generated stuff to simulate functional languages features).
The TypeCache is one of my favorite features Unity added recently. I think a lot of editor stuff will be much faster in the next year after devs start using it.
Ok that's the ThreadAbortException message erorr that can be caused when a domain reload occurs. You can usually ignore that message, I am still figuring out a way to discard the message.
Regarding the new feature to display the scene/prefab paths, take this screenshot
Those are all prefabs, and the prefab path is being shown.
But, in this search we're most likely interested in the prefab instances in the scenes.
Those are not prefabs. The scene name in bold is cool
I thought for a while and could not come up with a uniform solution to show the prefab path.
Maybe for scene objects, we should only show the full hierarchy path, not the actual asset path.
Description: [SceneName]/GameObject Hierarchy path
Then we can continue to use the "Open containing asset" to actually go to the prefab
To make it clear to the user that it is a prefab, we could make use of the editor icon for prefabs (same from the hierarchy).
Mockup example for the icon
Now, still regarding this. In my search tool, I also match for the scene name.
So, search "stage00 props" would show all objects with name that match "props", but only on stage00.
Our project has many small scenes that are loaded as part of a CompoundScene, so we often have a few dozen small-ish scenes loaded at any time.
One concrete example: we have some mask enemies with names containing the word Mask
But we also have pixel masks, like to cover the screen.
It is useful to be able to quickly filter all mask enemies that are in the Stagexx_Enemies scene.
So we type enem mask
The search, matching the "Stage01_Enemies" Mask enemies
I can further filter this to get the objects with Animators component
Well, that got a bit long.
Let me know if this is confusing or out-of-scope. I'm typing real quick because I'm leaving the office for today.
Thanks for reading!
Oh yeah! Maybe a try-catch there and discard the exception then it is ThreadAbortException?
Not out of scope at all. I'll give that a try and get back to you.
Here's what I have so far. You can filter by sub scene name, transform path and components (any component, but only the first one is displayed in the item label).
It is also great to search scene objects that match a given script component: