Search Unity

Quick Search Preview

Discussion in 'Editor Workflows' started by benoitd_unity, Feb 26, 2019.

  1. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    It was officially designed for 2019.1, but you can manually add it your manifest of a 2018.3 project and it will work. There is a post above that shows how to do it.
     
  2. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    Unfortunately shortcuts cannot be modified in 2018.3. The shortcut manager was completed in 2019.1. That said, you should be able to define a MenuItem function in your project and spawn the quick search window yourself. Let me know if you cannot get it to work.

    Thanks,
     
  3. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    640
    The keyboard input is so slow and it's almost unusable. It waits for the search result to return after each keystroke. Key input and the search should work asynchronously.

    Unity should make a requirement to do testing on a large size project. There are so many problems when the project size increases and you never know this because you never make games.
     
    slime73 likes this.
  4. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Shortcyt management wasn't a available in 18.3. You can still modify the menu items in the package code though.
     
  5. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    A new version with an update on performance for large projects (tested on actual large projects Chris) will be released shortly.

    Keep up the positive attitude Chris!
     
    sballew7 and jonathans42 like this.
  6. mpKira

    mpKira

    Joined:
    Jun 1, 2013
    Posts:
    4
    Hey there,

    thanks a lot for your work, looking forward to use quick search in my next project.

    Small question, is it possible to query a search from an editor script and show the results?
    E.G. I have a tool showing a list of all bundles used in the project, I click on one of the bundle names and a quick search window with results from "b:bundleName".

    I know it is possible to select those items, but I would ideally want the project window to only show the search results for a quick overview, and was wondering if this new tool might be the one to allow me to do this.

    Keep up the good work.
     
    jonathans42 likes this.
  7. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    You can open the QuickSearch from C#. And you can even overrides its search filter. We have already register specific shortcut to pop the QuickSearch in a specific search mode (ex: Alt + Shift + p will open the Quick search in project mode):

    Code (CSharp):
    1. [UsedImplicitly, Shortcut("Help/Quick Search/Assets")]
    2. public static void PopQuickSearch()
    3. {
    4.     SearchService.Filter.ResetFilter(false);
    5.     SearchService.Filter.SetFilter(true, type);
    6.     SearchService.Filter.SetFilter(false, type, "a:" + areaFilter[1]);
    7.     QuickSearchTool.ShowWindow(false);
    8. }
     
    ReptileDev and slime73 like this.
  8. Huacanacha

    Huacanacha

    Joined:
    Aug 16, 2013
    Posts:
    48
    Hi, this will be a great addition to Unity. Some feature requests:
    - a way to open files directly via keyboard vs just selecting them (enter to select, cmd+enter to open for example)... this is much more efficient than using the dropdown menu
    - prioritize frequently accessed items so that most accessed files are bubbled to top of list by default. This is a big part of what actually makes Spotlight Search or Alfred etc useful.
    - fuzzy search (already mentioned by others above)

    Also, is there a way to filter a search by asset type (just scenes, just scripts etc) or just by search provider (asset, scene, menu etc)? If not please add that!
     
  9. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    Once you have an asset selected in the quick search window, try ALT+Enter or looks at the additional action available by clicking on the vertical dots on the far right of the item.
     
    Huacanacha likes this.
  10. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    We have on the TODO list to add priority and sorting editing so you can sort which results should show first, etc.
     
    Huacanacha likes this.
  11. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    As discussed above, fuzzy search is high on the TODO list.

    If you want to search by type you can enter t:TYPE or *.png
     
    Huacanacha likes this.
  12. Huacanacha

    Huacanacha

    Joined:
    Aug 16, 2013
    Posts:
    48
    Perfect, that's just what I'm after. Would be a good idea to add the key shortcut to the vertical dot menu items for easier discovery.
     
  13. Huacanacha

    Huacanacha

    Joined:
    Aug 16, 2013
    Posts:
    48
    Is there a way to search specific folders yet? That would be very useful to cut down on noise, filter out third party assets etc. It would be especially useful if you could search from the currently selected folder.
     
  14. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    640
    @sebastienp_unity thanks for the update. You don't know how much troubles I'm having with my project as it grows and it's really frustrating. I've been trying to be nice and helpful but often, being nice lead to nowhere. Here is just a couple of things I'm saying repeatedly. Make sure Unity works well in large size project and make sure UX works efficiently with multi-monitor setups. Right now, the Editor very clunky as project size grows and UI is very claustrophobic(too much context switching(reusing window space) and not designed with larger sized multi-monitor)
    Thanks.
     
    Yozaro likes this.
  15. Elyaradine

    Elyaradine

    Joined:
    Aug 13, 2015
    Posts:
    21
    Haven't used this just yet, but popping in to say that this was sorely needed and I'm super happy that you're working on this! Thank you so much!
     
  16. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    601
    Looks great so far! A few requests:

    - ctrl+n/ctrl+p to change the selected object (ie, ctrl+n is down arrow and ctrl+p is up arrow)
    - a keyboard shortcut to ping the selected object

    I was looking through the API and I don't see a way to implement these using what's publicly accessible via the [MenuItem] approach discussed above.

    Thanks!
     
  17. sschoener

    sschoener

    Joined:
    Aug 18, 2014
    Posts:
    73
    This is only tangentially related to the new QuickSearch (great job on that one!), but I thought you might be interested anyway: A few months ago I prototyped a similar tool for Unity 2018.3 (as alluded to in an earlier post) and I have now released its sources, find more details here. One of the main features is a pretty fast search for asset files, even when you have 300k of them in your project (yes, I have tested that). It's a prototype still and should probably be completely rewritten, but if anyone here fancies to use it and compare it to the new QuickSearch, go for it.
     
  18. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,905
    I'm noticing a minor issue with Quick Search preview 2 & Unity 2018.3. It doesn't play well with text fields. When I have a text field selected, and press option+' it doesn't show the Quick Search but inserts a special character into the selected text field. Could you change the keyboard shortcut to something that plays better with text fields?
     
  19. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    For your second suggestion: this means you would like an action to ping and NOT to select the object? Currently pressing enter on an bject will select it and ping it.

    Few information:

    - The default action on an item can be activated with Enter (pretty obvious)
    - PRessing Alt + Right pops the action menus for item supporting more than one actions
    - PRessing Alt + Enter executes the second action on an item
    - PRessing Ctrl + Enter executes the third action

    You could easily register a new action to only ping an item. OR you could modify one of the currently registered actiuon to ping an item (Open maybe?). Then you could use Alt/Ctrl + Enter to access the ping action. There is no way to garanty the different order of actions for now (this will be added to the to do list).


     
  20. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Thanks for the feedback I didn't know about Unity Commander. Like Jonathan said earlier we have a new version coming soon that will speed up search dramatically. We have tested it with projects with millions of assets and it was really responsive.

     
  21. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Currently QuickSearch was aimed at 2019.1 (though it works with 2018.3). 2019.1 has a new shortcut manager that allows easy rebinding of shortcut.

    That said, I will see what can be done for the default shortcut in 2018.3.

    If all else fails this is something you can easily do on your side (the whole plugin is written in C#). Look for:

    Look for:

    Code (CSharp):
    1.  
    2. #if UNITY_2019_1_OR_NEWER
    3. [UsedImplicitly,
    4. Shortcut("Help/Quick Search", KeyCode.O, ShortcutModifiers.Alt | ShortcutModifiers.Shift),
    5. MenuItem("Help/Quick Search &'", priority = 9000)]
    6. #else
    7. [MenuItem("Help/Quick Search &'", priority = 9000)]
    8. #endif
    9. private static void PopQuickSearch()
    10. {
    11.     ShowWindow();
    12. }
    13.  
    In QuickSearch.cs

     
  22. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,905
    I wasn't aware that I could modify packages. If I do, does it affect all of my projects or just the one where I made the modification? When I attempt to edit the script I get a popup that says that I don't have write permissions.
     
  23. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    Hi Chris,

    In the next version you'll be able to toggle that new option to get a window that you can place and resize as you want:

    upload_2019-4-23_15-47-19.png
     
  24. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    601
    Thanks! I was able to get the actions registered with the code below. It'd be great if I could force this action to be the first so Alt+Enter always pings (otherwise the keyboard combo is ctrl+alt+shift+meta+enter, which is quite hard to hit).

    Will ctrl+n/ctrl+p be supported? It looks like the menu that pops up when you press alt+right supports it.

    edit: ping is useful when you want to locate an asset to drag and drop to the current selection

    Code (csharp):
    1.  
    2. using System;
    3. using System.Collections.Generic;
    4. using Unity.QuickSearch;
    5. using UnityEditor;
    6. using UnityEngine;
    7. using UnityObject = UnityEngine.Object;
    8.  
    9. namespace Game {
    10.   public class PingOnlyActionProvider {
    11.     [SearchActionsProvider]
    12.     internal static IEnumerable<SearchAction> ActionHandlers() {
    13.       return new[] {
    14.         new SearchAction("scene", "ping", null, "Ping asset...") {
    15.           handler = (item, context) => {
    16.             var instanceId = Convert.ToInt32(item.id);
    17.             var obj = EditorUtility.InstanceIDToObject(instanceId);
    18.             if (obj)
    19.               EditorGUIUtility.PingObject(obj);
    20.           }
    21.         },
    22.         new SearchAction("asset", "ping", null, "Ping asset...") {
    23.           handler = (item, context) => {
    24.             var asset = AssetDatabase.LoadAssetAtPath<UnityObject>(item.id);
    25.             if (asset)
    26.               EditorGUIUtility.PingObject(asset);
    27.           }
    28.         },
    29.       };
    30.     }
    31.   }
    32. }
    33.  
     
    Last edited: Apr 23, 2019
    jonathans42 likes this.
  25. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    640
    Awesome!! Thank you very much. I think it will become an indispensable tool quickly. Please keep the good work.
     
    jonathans42 likes this.
  26. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    There is no way to narrow down which folders to search EXCEPT to exclude packages. See the Filter window for more filter.

    When you say: "It would be especially useful if you could search from the currently selected folder." you mean from the current folder in the ProjectBrowser?

    Being able to remove certain folder (like plugins/third party assets) would be great. We will have top think about the best way to specify this.

     
    Huacanacha likes this.
  27. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Great example of an ActionProvider. We are in the process of adding preferences to the tool. Being able to reorder actions in the action menu will be on our todo list (not committing to a date though). This would effectively allow you to modify the default actions when you click on an item (and which actions are bound to atl + enter and such).

    We will look at better navigation (pageup + down and such).



     
  28. Huacanacha

    Huacanacha

    Joined:
    Aug 16, 2013
    Posts:
    48
    Yes that's exactly what I mean - the currently selected folder in the Project window. This would be just like a Finder search on Mac where you can select everything or the current folder as the search root.

    Plugins/third_party_assets is the main offender so excluding that would help. However some plugins don't like being moved, plus depending on project organization (especially on larger projects) there may be good reasons to limit a specific search to a root folder.

    If it's not on the roadmap consider this a feature request ;) The implementation could be d: to search from a directory (like p: searches all Project/Asset files)... it could default to Assets/ if there is not a directory selected in Project view.
     
  29. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,495
    Any update on that new version where folder search won't slow it to a crawl?

    I'm trying it in 2018.3, and it's looking good, but not there yet. Had to turn off the folder search, as it destroys the performance. Without that, it's pretty fast.

    ... that is, until you try to introduce a * character. I'm not sure if it's read as a wildcard or if it activates a regex mode, but performance goes into the dumpster.

    In general, I think that the text input shouldn't have to wait on search results to be filtered before I can enter a new letter.


    Finally, it seems like "t:Script" or "t:prefab" is broken - if I search for "Player t:Script" as shown in the docs, I get all kinds of prefabs and scenes:

    upload_2019-4-26_14-14-6.png

    t:prefab is kind of essential for what I use search for.

    OH MY GOD UNITY FORUMS PLEASE THE :p EMOJI GAAAH
     

    Attached Files:

  30. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,905
    +1 For the idea of waiting until the user has finished typing before searching. I know exactly what I want to type in, but it takes longer than it should because Quick Search is constantly re-searching every time I type a character. Make it just like the Project view search feature, how it waits a bit before showing results.
     
  31. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,495
    Oh, another thing, this sorting seems wrong:

    upload_2019-4-27_13-22-16.png

    I think the file on the bottom should be on the top. Might it be that you're including the ".prefab" in the sorting? I don't think extensions - especially shared extensions - should be a part of the sorting.
     
  32. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,905
    Feature Request: Add support for searching with extensions. If I know I'm looking for a script, let me type in ScriptName.cs.
     
  33. JacobFast

    JacobFast

    Joined:
    Apr 29, 2014
    Posts:
    13
    Common situation:

    i have 100s of folders with 100s of animations of same name like
    animation/solder/run.anim
    animation/solder_green/run.anim
    animation/solder_blue/run.anim
    animation/solder/sit.anim
    animation/solder_green/sit.anim
    animation/solder_blue/sit.anim

    Whats the fastest way to find solder_blue/sit.anim without scrolling through a huge list of animations (if i type sit there will be all sit animations from all folders, if i type solder_blue/sit then it does not find anything) ?
     
  34. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Next update will have "debouncing" on character typing. It will wait for 100ms of inactivity before starting the search.

     
    HonorableDaniel likes this.
  35. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    We are in the process of adding analytics for the next release (which contains the perf update for Folder search). but because of server trouble this latest update has been late. Sorry about that.

    We will look at the t:Script and t:prefab. I am a bit surprise it fails as this search query is directly fed to the AssetDatabase itself.

     
    Baste likes this.
  36. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    The AssetProvider uses (mostly) the AssetDatabase to find results. And using a / in the name doesn't play well with the AssetDatabase search.

    We will try to make improve this type of search by using File system indexation.

     
  37. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Noted. See previous answer: we will try to improve the AssetProvider results by adding more results from File system search instead of only using AssetDatabase.

     
    HonorableDaniel likes this.
  38. Arkuni

    Arkuni

    Joined:
    May 30, 2013
    Posts:
    12
    If I try to filter out sprites, then it also removes all my ScriptableObjects. What's up with that?
     
  39. Arkuni

    Arkuni

    Joined:
    May 30, 2013
    Posts:
    12
    Feature Request: Being able to search for the name of the ScriptableObject Script (not the file name, but the script name that the file is based on).

    It would be nice to search for "player1 skin" and then find the file "player1" which is made from ScriptableObject "Skin.cs"
     
  40. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    Hi, we will add partial and fuzzy matching in an upcoming version. For now we rely mostly on the AssetDatabase API and if you use wildcards, i.e. *, we also run some local file system searches.

    We are working on an much more powerful indexing system to allow this type of partial and fuzzy search.

    Stay tuned.
     
    HonorableDaniel and SugoiDev like this.
  41. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    Hi, here's a preview of the new reverse indexed search that we propose. For your specific case if you type "sol blu anim", the system should give you a result quite fast.

    qs_asset_reverse_indexing.gif

    Summary of this new asset search provider:
    - Add reversed indexing of all project assets,
    - Add support for unordered search patterns (i.e. aster images, matches `Assets/Images/asteroids/...`
    - Parse a ~250,000 assets project under 10 seconds,
    - Search assets under *1-2 ms* compared to >= 100 ms using the asset database `FindAsset` API for a large project,
    - The index is saved per project for quick reloading under Library/qs.index.

    The preview shows what results and how much time it took for the asset database compared to when the new indexing system when enabled.
     
    Baste, SugoiDev, slime73 and 2 others like this.
  42. andrew-newmandilfer

    andrew-newmandilfer

    Joined:
    Dec 16, 2015
    Posts:
    4
    Yes, this would be amazing! It is something we really want for our work.
     
  43. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    A new version (com.unity.quicksearch@1.0.9-preview.2) has been publish if some of you wants to give it a try.
     
    SugoiDev likes this.
  44. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,495
    SugoiDev likes this.
  45. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    220
    It depends from which version you are coming from, but here's the full change log:


    ## [1.1.0-preview] - 2019-05-08
    - Update UI for Northstar retheming
    - Fix search item caching

    ## [1.0.9-preview.2] - 2019-05-06
    - Add editor analytics
    - Add fast indexing of the project assets file system.
    - Add option to open the quick search in a dockable window.
    - Add search service tests
    - Add shortcut key bindings to the menu item descriptor.
    - Add typing debouncing (to prevent searching for nothing while typing fast)
    - Add yamato-CI
    - Format the search item description to highlight the search terms.
    - Improve documentation
    - Improve the performance of searches when folder filter is selected.
    - Record average fetch time of search provider and display those times in the Filter Window.
    - Remove assets and scene search provider default shortcuts. They were conflicting with other core shortcuts.
    - Remove duplicate items from search result.

    ## [1.0.1-preview.1] - 2019-02-27
    - Fix ReflectionTypeLoadException exception for certain user with invalid project assemblies
    - Optimize fetching results from menu, asset and scene search providers (~50x boost).

    ## [1.0.0-preview.2] - 2019-02-26
    - Update style to work better with the Northstar branch.
    - Use Alt+Left to open the filter window box.
    - Use Alt+Down to cycle to next recent search.
    - Navigate the filter window using the keyboard only.
    - Consolidate web search providers into a single one with sub categories.
    - Update documentation to include new features.
    - Set the game object as the selected active game object when activated.

    ## [0.9.95-preview] - 2019-02-25
    - Add AssetStoreProvider example
    - Add HTTP asynchronous item loading by querying the asset store.
    - Add onEnable/onDisable API for Search provider.
    - Add Page Up and Down support to scroll the item list faster.
    - Add search provider examples
    - Add support for async results
    - Cycle too previous search query using ALT+UpArrow
    - Fix various Mac UX issues
    - New icons
    - Select first item by default en pressing

    ## [0.9.9-preview.2] - 2019-02-21
    - Added drag and drop support. You can drag an item from the quick search tool to a drop target.
    - Open the item contextual menu by pressing the keyboard right arrow of the selected item.
    - Fixed folder entry search results when only the folder filter is selected.
    - Fixed showing popup when alt-tabbing between windows.
    - Add support for rich text label and description.
    - Updated documentation

    ## [0.9.7-preview.3] - 2019-02-20
    - Fixed cursor blinking
    - Improved fetched scene object results

    ## [0.9.6-preview.1] - 2019-02-20
    - Moved menu items under Help/
    - Added a warning when all filters are disabled.
    - Added search field cursor blinking.
    - Added search field placeholder text when not search is made yet.
    - Fixed a layout scoping issue when scrolling.

    ## [0.9.5-preview.1] - 2019-02-19
    - First Version
    - Search menu items
    - Search project assets
    - Search current scene game objects
    - Search project and preference settings
    - Build a search query for Unity Answers web site
    - Build a search query for the Unity Documentation web site
    - Build a search query for the Unity Store web site

     
  46. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,495
    Is Northstar the internal name for the new UI?

    I also still don't get only prefabs when adding t:prefab to the search. Is that something you're aware of internally, or should I cough up a bug report?
     
  47. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,495
    Just noticed that in the utils.cs, you've got this method:

    Code (csharp):
    1.  
    2.         [MenuItem("Tools/packageMe")]
    3.         internal static void TestMe()
    4.         {
    5.            
    6.         }
    7.  
    Which gives me this:

    upload_2019-5-10_11-15-6.png

    Something left over from development, or? Could you clean it up?
     
  48. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Good catch, I removed TestMe :)

    As for the t: Prefab issue it needs explanation on the search workflow. Example: you type "Player t: Prefab" in the search query. t: Prefab becomes a "filter" while "Player" is the text query.
    - The whole search query is passed to all enabled Search provider
    - The AssetSearchProvider knows how interprets t: Prefab and will return only prefabs assets
    - Other SearchProviders (Menu, actions, scene) will ignore the t: Prefab filter since they do not know how to interpret it. But they still will return items matching the "text" of the query.

    We could implicitly disable search providers when an unknown filter is passed to them... We will think about it over the weekend.

    Thanks for the quick feedback Baste. Always appreciated.

     
  49. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    30
    Northstar is indeed the name for the new theme. Hope you like it.

     
  50. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,495
    Thanks, that's a great explanation.

    What I want to do in the case where I'm searching for "Player t:prefab" is to get all prefabs that match the string Player. The best way to do that is to search for "Player" with only the prefab search provider enabled.

    The provider search filter token seems to be the perfect way to handle that. You have a p: prefix that can be used to filter for assets. Could I suggest to add more filters, and make them easier to remember?

    as: for assets
    sc: for scene
    me: for menu
    pr: for prefabs
    cs: for scripts (.cs file)
    sh: for shaders

    Or something along those lines.
     
unityunity