Search Unity

Official Quick Search Preview

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

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    If you have a budget, or are a student, you can grab Rider, which supports those exact things. If not, then idk.
     
    jonathans42 and SugoiDev like this.
  2. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    We do not index source code out of the box. That said, we have a search provider example that uses ESS (Entrain Source Search), that you could tweak for your needs.

    If you have ESS installed in its default location, you should be able to just drop the example in your project and it should work.

    Here's the search provider example source code (this code is not optimal, but a good starting example):

    Code (CSharp):
    1.  
    2. using JetBrains.Annotations;
    3. using System;
    4. using System.Collections.Generic;
    5. using System.Diagnostics;
    6. using System.IO;
    7. using System.Text.RegularExpressions;
    8. using System.Threading;
    9. using UnityEngine;
    10.  
    11. namespace Unity.QuickSearch.Providers
    12. {
    13.     [UsedImplicitly]
    14.     static class ESS
    15.     {
    16.         internal static string type = "ess";
    17.         internal static string displayName = "Source Search";
    18.         internal static string ess_exe = @"C:\Program Files (x86)\Entrian Source Search\ess.exe";
    19.  
    20.         internal static bool s_BuildingIndex = true;
    21.  
    22.         internal static string indexPath => Path.GetFullPath(Path.Combine(Application.dataPath, "../Library/ess.index"));
    23.         internal static Regex essRx = new Regex(@"([^(]+)\((\d+)\):\s*(.*)");
    24.  
    25.         struct ESSMatchInfo
    26.         {
    27.             public string path;
    28.             public int lineNumber;
    29.             public string content;
    30.         }
    31.  
    32.         struct RunResult
    33.         {
    34.             public int code;
    35.             public string output;
    36.             public Exception exception;
    37.         }
    38.  
    39.         [UsedImplicitly, SearchItemProvider]
    40.         internal static SearchProvider CreateProvider()
    41.         {
    42.             if (!File.Exists(ess_exe))
    43.                 return null;
    44.  
    45.             return new SearchProvider(type, displayName)
    46.             {
    47.                 active = false, // Still experimental
    48.                 priority = 7000,
    49.                 filterId = "ess:",
    50.                 isExplicitProvider = true,
    51.                 fetchItems = (context, items, provider) => SearchEntries(context, provider),
    52.  
    53.                 fetchThumbnail = (item, context) =>
    54.                 {
    55.                     if (item.data == null)
    56.                         return null;
    57.  
    58.                     var essmi = (ESSMatchInfo)item.data;
    59.                     return (item.thumbnail = UnityEditorInternal.InternalEditorUtility.FindIconForFile(essmi.path));
    60.                 }
    61.             };
    62.         }
    63.  
    64.         [UsedImplicitly, SearchActionsProvider]
    65.         internal static IEnumerable<SearchAction> ActionHandlers()
    66.         {
    67.             return new[]
    68.             {
    69.                 new SearchAction(type, "reveal", null, "Locate statement...")
    70.                 {
    71.                     handler = (item, context) =>
    72.                     {
    73.                         var essmi = (ESSMatchInfo)item.data;
    74.                         #if UNITY_2019_3_OR_NEWER
    75.                         CodeEditor.CodeEditor.CurrentEditor.OpenProject(essmi.path, essmi.lineNumber);
    76.                         #elif UNITY_2019_2_OR_NEWER
    77.                         UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(essmi.path, essmi.lineNumber, -1);
    78.                         #else
    79.                         UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(essmi.path, essmi.lineNumber);
    80.                         #endif
    81.                     }
    82.                 }
    83.             };
    84.         }
    85.  
    86.         private static RunResult RunESS(params string[] args)
    87.         {
    88.             var result = new RunResult { code = -1 };
    89.  
    90.             try
    91.             {
    92.                 var essProcess = CreateESSProcess(args);
    93.  
    94.                 essProcess.OutputDataReceived += (sender, log) => result.output += log.Data + "\n";
    95.                 essProcess.Start();
    96.                 essProcess.BeginOutputReadLine();
    97.  
    98.                 essProcess.WaitForExit();
    99.  
    100.                 result.output = result.output.Trim();
    101.                 result.code = essProcess.ExitCode;
    102.             }
    103.             catch (Exception e)
    104.             {
    105.                 result.exception = e;
    106.             }
    107.  
    108.             return result;
    109.         }
    110.  
    111.         private static Process CreateESSProcess(params string[] args)
    112.         {
    113.             var essProcess = new Process
    114.             {
    115.                 StartInfo =
    116.                 {
    117.                     WindowStyle = ProcessWindowStyle.Hidden,
    118.                     CreateNoWindow = true,
    119.                     UseShellExecute = false,
    120.                     RedirectStandardOutput = true,
    121.                     FileName = ess_exe,
    122.                     Arguments = String.Join(" ", args)
    123.                 },
    124.  
    125.                 EnableRaisingEvents = true
    126.             };
    127.  
    128.             return essProcess;
    129.         }
    130.  
    131.         private static string ParamValueString(string param, string value)
    132.         {
    133.             return $"-{param}=\"{value}\"";
    134.         }
    135.  
    136.         [UsedImplicitly, UnityEditor.InitializeOnLoadMethod]
    137.         private static void BuildIndex()
    138.         {
    139.             if (!File.Exists(ess_exe))
    140.                 return;
    141.  
    142.             var localIndexPath = indexPath;
    143.             var localDataPath = Application.dataPath;
    144.             var thread = new Thread(() =>
    145.             {
    146.                 var result = new RunResult { code = 0 };
    147.                 // Create index if not exists
    148.                 if (!Directory.Exists(localIndexPath))
    149.                     result = RunESS("create", ParamValueString("index", localIndexPath), ParamValueString("root", localDataPath),
    150.                                     ParamValueString("include", "*.cs,*.txt,*.uss,*.asmdef,*.shader,*.json"),
    151.                                     ParamValueString("exclude", "*.meta"));
    152.  
    153.                 if (result.code != 0)
    154.                 {
    155.                     UnityEngine.Debug.LogError($"[{result.code}] Failed to create ESS index at {localIndexPath}\n\n" + result.output);
    156.                     if (result.exception != null)
    157.                         UnityEngine.Debug.LogException(result.exception);
    158.                     return;
    159.                 }
    160.  
    161.                 // Update index
    162.                 if (RunESS("update", ParamValueString("index", localIndexPath)).code != 0)
    163.                     result = RunESS("check", ParamValueString("index", localIndexPath), "-fix");
    164.  
    165.                 if (result.code != 0)
    166.                 {
    167.                     UnityEngine.Debug.LogError($"[{result.code}] Failed fix the ESS index at {localIndexPath}\n\n" + result.output);
    168.                     if (result.exception != null)
    169.                         UnityEngine.Debug.LogException(result.exception);
    170.                     return;
    171.                 }
    172.  
    173.                 //UnityEngine.Debug.Log("ESS index ready");
    174.                 s_BuildingIndex = false;
    175.             });
    176.             thread.Start();
    177.         }
    178.  
    179.         private static SearchItem ProcessLine(string line, string searchQuery, SearchProvider provider)
    180.         {
    181.             line = line.Trim();
    182.  
    183.             var m = essRx.Match(line);
    184.             var filePath = m.Groups[1].Value.Replace("\\", "/");
    185.             var essmi = new ESSMatchInfo
    186.             {
    187.                 path = filePath.Replace(Application.dataPath, "Assets").Replace("\\", "/"),
    188.                 lineNumber = int.Parse(m.Groups[2].Value),
    189.                 content = m.Groups[3].Value
    190.             };
    191.             var fsq = searchQuery.Replace("*", "");
    192.             var content = Regex.Replace(essmi.content, fsq, "<color=#FFFF00>" + fsq + "</color>", RegexOptions.IgnoreCase);
    193.             var description = $"{essmi.path} (<b>{essmi.lineNumber}</b>)";
    194.             return provider.CreateItem(essmi.content.GetHashCode().ToString(), content, description, null, essmi);
    195.         }
    196.  
    197.         private static IEnumerable<SearchItem> SearchEntries(SearchContext context, SearchProvider provider)
    198.         {
    199.             var localSearchQuery = context.searchQuery;
    200.  
    201.             while (s_BuildingIndex)
    202.             {
    203.                 yield return null;
    204.             }
    205.  
    206.             Process essProcess;
    207.             var lines = new List<string>();
    208.             //using (new DebugTimer("ProcessStart"))
    209.             {
    210.                 try
    211.                 {
    212.  
    213.                     essProcess = CreateESSProcess("search", ParamValueString("index", indexPath), localSearchQuery);
    214.                     essProcess.OutputDataReceived += (sender, log) =>
    215.                     {
    216.                         lock (lines)
    217.                         {
    218.                             lines.Add(log.Data);
    219.                         }
    220.                     };
    221.                     essProcess.Start();
    222.                     essProcess.BeginOutputReadLine();
    223.  
    224.                 }
    225.                 catch (Exception e)
    226.                 {
    227.                     UnityEngine.Debug.LogException(e);
    228.                     yield break;
    229.                 }
    230.             }
    231.  
    232.             while (!essProcess.WaitForExit(1))
    233.             {
    234.                 // Copy the collection so it does not get modified during enumeration
    235.                 string[] linesCopy;
    236.                 lock (lines)
    237.                 {
    238.                     linesCopy = lines.ToArray();
    239.                     lines.Clear();
    240.                 }
    241.  
    242.                 foreach (var searchItem in SearchLines(provider, linesCopy, localSearchQuery))
    243.                     yield return searchItem;
    244.                 yield return null;
    245.             }
    246.  
    247.             foreach (var searchItem in SearchLines(provider, lines, localSearchQuery))
    248.                 yield return searchItem;
    249.         }
    250.  
    251.         private static IEnumerable<SearchItem> SearchLines(SearchProvider provider, IEnumerable<string> lines, string searchQuery)
    252.         {
    253.             foreach (var l in lines)
    254.             {
    255.                 if (l == null)
    256.                 {
    257.                     yield return null;
    258.                     continue;
    259.                 }
    260.  
    261.                 yield return ProcessLine(l, searchQuery, provider);
    262.             }
    263.         }
    264.     }
    265. }
    266.  
    upload_2019-10-29_8-36-3.png
     
    Peter77, brianchasalow and SugoiDev like this.
  3. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    This is a great hot tip for workflow speed hacks- @jonathans42. Thank you!
     
  4. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Would it be possible to make QuickSearch it reorder the results based on use? Like, you type "something", then press down a few times to find your specific "something", then you act on it. Next time you time "something", that "something" you acted on will be the first result in the list. If you do this again, but select a different "something", then your previously selected one will now be the second on the list. And so on.


    I noticed how useful this is after migrating my Windows keyboard launcher from TypeAndRun to Keypirinha.
    TypeAndRun only had history like a command prompt, where you have to press up to restore the previous typed command. Keypirinha has an option where it will push the last used command to the top of the results. This effectively associates whatever you type with a specific result. An alias of sorts.
    This also makes it easier to act on something again real quick. Just hit the hotkey and then hit enter.


    Thanks for reading.
     
  5. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    I have some quick ideas

    1- Ability to open ALT-RIGHT menu with tab.
    2- First option always selected, so we can type enough then immediately press enter instead of requiring using the arrow keys.
    4- Ability to open ALT-RIGHT menu inside of Quick-Search, not as a OS context menu. The search box should reset and potentially have breadcrumbing (e.g. SELECTION/ICON > INPUT BOX). This would allow typing to quickly access certain menu items.
    5- Ability to tweak height of menu items.
    6- Ability to tweak height of selected menu item individually.
     
  6. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Which version of QuickSearch do you have? There is a ranking algorithm already in place that gives a better score to items that have been chose before and make them bubble up at the top of the list.

     
  7. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    1- Ability to open ALT-RIGHT menu with tab.

    Thanks for the suggestions. Being able to customize shortcut inside the QuickSearch window is something we could look for (maybe using the ShortcutManager). But this is not something supported out of the box with Unity :(

    2- First option always selected, so we can type enough then immediately press enter instead of requiring using the arrow keys.
    4- Ability to open ALT-RIGHT menu inside of Quick-Search, not as a OS context menu. The search box should reset and potentially have breadcrumbing (e.g. SELECTION/ICON > INPUT BOX). This would allow typing to quickly access certain menu items.

    The FilterWindow could be improved. Are you suggesting it shouldn't be modal and should always be visible? Since we already display which filters are on in the QuickSearch status bar, we could allow a user to at least discard some of the filters by clicking on them.

    5- Ability to tweak height of menu items.

    QuickSearch uses a virtual scrolling algorithm that makes it fast to display big lists. In order to do so all items have to be the same size though. So we could allow a user to tweak the size of all items. Do you want items to be bigger? Smaller? Because if we change the size of items it means we also need to tweak how the item data is displayed (font size, layout).

    6- Ability to tweak height of selected menu item individually.[/QUOTE]

    See above
     
  8. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    I'm on 1.4.2 preview 3. Is there a newer one?
    I have a ScriptableObject that I've been calling dozens of times a day and it's result is not bumped to the top.
     
  9. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    See above[/QUOTE]

    4- I'll try to clarify. When I access the ALT-RIGHT, it opens a menu like a context or right-click OS menu. To choose the action I want, I have to navigate with the up and down arrow keys. I'm suggesting that pressing ALT-RIGHT would instead re-use the Quick Search window itself by filling the search entries with items from the ALT-RIGHT menu. That way for example I could enter these inputs

    • "asset name"
    • ALT-RIGHT (or my preferred key which would be TAB)
    • "explorer"
    • ENTER
    to open the asset I want in the File Explorer, without use of the arrow keys.

    5- I should have precised, I'd like to make the entries shorter in particular, that way I can fill the screen with more.

    6- I was mainly suggesting this because making the entries shorter (#5) would mean it'd reduce the visibility on the thumbnails, so we could expand the selected entry's height a bit. (although I have no idea how it would feel in practice) No big deal if it can't be done though.

    edit:
    2- I see what you mean now, it does work after trying it. The reason I thought it wouldn't select the first element by default is because it doesn't get highlighted, so I'd suggest fixing this instead to make it more obvious.
     
    Last edited: Nov 8, 2019
  10. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Ok I'll double check the recent item serialization. Maybe there is a small issue hidden somewhere. I'll keep you updated.
     
    SugoiDev likes this.
  11. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    I hate that feature pretty much everywhere it pops up. Could we please get to disable it?

    I want to get better at using my tools. As a part of that, I need to learn what to input in order to make them do what I want. When what my input does changes, because the tool is reacting to what I input, it becomes impossible to learn it.

    I much prefer to know that a certain result is going to be three steps down when I write a search term, and then go "quick search shortcut - write search term - down - down - enter" on autopilot, rather than having that item slowly bubble towards the surface and kill my muscle memory.
     
    Peter77 likes this.
  12. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Also, there's something fishy with the search results for the scene:

    upload_2019-11-20_9-56-48.png

    The gameobject that has the best matching name is the fifth result. One of it's children is the first result.
     
  13. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    I am with you on this one. We'll see what we can do for the next release.

    Thanks,
     
  14. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi,

    Quick Search 1.5.0-preview.1 has been released.

    - [UX] We've removed the dockable window mode of Quick Search since it wasn't playing nice with some loading and refreshing workflows and optimizations.
    - [UX] Select search item on mouse up instead of mouse down.
    - [UX] fetchPreview of AssetStoreProvider uses the PurchaseInfo to get a bigger/more detailed preview.
    - [UX] Add selected search item preview panel.
    - [UX] Add Resource provider, which lets you search all resources loaded by Unity.
    - [UX] Add documentation link to Help provider and version label.
    - [UX] Add Asset Store provider populating items with asset store package.
    - [FIX] Add support for digits when splitting camel cases of file names.
    - [FIX] Only enable the search asset watcher once the quick search tool is used the first time.
    - [DOC] Quick Search Manual has been reviewed and edited.
    - [API] Make Unity.QuickSearch.QuickSearch public to allow user to open quick search explicitly with specific context data.
    - [API] Add `QuickSearch.ShowWindow(float width, float height)` to allow opening Quick Search at any size.

    Let us know what you think of the new details panel. It doesn't add much for now other than displaying a bigger preview, but eventually it could hold many other things such as in-place editors, display more information about the current item, etc.

    upload_2019-11-25_15-49-54.png
     
    SugoiDev likes this.
  15. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Got this after opening it after updating to 1.5.0-preview.1 on 2020.1.0a14 today:

    Code (CSharp):
    1. [Exception] InvalidOperationException: User is not logged in or user status invalid.
    2. UnityOAuth.GetAuthorizationCodeAsync()    <f77adbe680d5435ab56e2403863ec057>:0
    3.  
    4. AssetStoreProvider.GetAuthCode()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/Providers/AssetStoreProvider.cs:572
    5. 570:   }
    6. -->572:   UnityEditor.Connect.UnityOAuth.GetAuthorizationCodeAsync("packman", response =>
    7. 573:   {
    8. 574:       if (response.Exception != null)
    9.  
    10. AssetStoreProvider.GetAccessToken()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/Providers/AssetStoreProvider.cs:603
    11. 601:   }
    12. -->603:   GetAuthCode((authCode, exception) =>
    13. 604:   {
    14. 605:       if (exception != null)
    15.  
    16. AssetStoreProvider.GetAccessTokenInfo()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/Providers/AssetStoreProvider.cs:628
    17. 626:   }
    18. -->628:   GetAccessToken((accessTokenData, error) =>
    19. 629:   {
    20. 630:       if (error != null)
    21.  
    22. AssetStoreProvider.GetUserInfo()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/Providers/AssetStoreProvider.cs:652
    23. 650:       return;
    24. 651:   }
    25. -->652:   GetAccessTokenInfo((accessTokenInfo, error) =>
    26. 653:   {
    27. 654:       if (error != null)
    28.  
    29. AssetStoreProvider.GetAllPurchases()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/Providers/AssetStoreProvider.cs:669
    30. 667:   static void GetAllPurchases(Action<List<PurchaseInfo>, string> done)
    31. 668:   {
    32. -->669:       GetUserInfo((userInfo, userInfoError) =>
    33. 670:       {
    34. 671:           if (userInfoError != null)
    35.  
    36. AssetStoreProvider.CheckPurchases()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/Providers/AssetStoreProvider.cs:385
    37. 383:   s_StartPurchaseRequest = true;
    38. 384:   var startRequest = System.Diagnostics.Stopwatch.StartNew();
    39. -->385:   GetAllPurchases((purchases, error) =>
    40. 386:   {
    41. 387:       s_StartPurchaseRequest = false;
    42.  
    43. AssetStoreProvider.OnEnable()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/Providers/AssetStoreProvider.cs:368
    44. 366:   static void OnEnable()
    45. 367:   {
    46. -->368:       CheckPurchases();
    47. 369:   }
    48.  
    49. SearchService.Enable()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/SearchService.cs:256
    50. 254:   using (var enableTimer = new DebugTimer(null))
    51. 255:   {
    52. -->256:       provider.onEnable?.Invoke();
    53. 257:       provider.enableTime = enableTimer.timeMs;
    54. 258:   }
    55.  
    56. QuickSearch.OnEnable()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/QuickSearch.cs:559
    57. 557:   m_CurrentSearchEvent = new SearchAnalytics.SearchEvent();
    58. 558:   m_Context = new SearchContext { searchText = String.Empty, focusedWindow = lastFocusedWindow, searchView = this };
    59. -->559:   SearchService.Enable(m_Context);
    60. 560:   m_Context.searchText = SearchService.LastSearch;
    61. 561:   m_SearchBoxFocus = true;
    62.  
    63. ScriptableObject.CreateInstance()
    64.  
    65. QuickSearch.ShowWindow()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/QuickSearch.cs:1717
    66. 1716:   var windowSize = new Vector2(defaultWidth, defaultHeight);
    67. -->1717:   var qsWindow = CreateInstance<QuickSearch>();
    68. 1718:   qsWindow.ShowDropDown(windowSize);
    69.  
    70. QuickSearch.OpenQuickSearch()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/QuickSearch.cs:1887
    71. 1885:   {
    72. 1886:       SearchService.LoadFilters();
    73. -->1887:       ShowWindow();
    74. 1888:   }
    75.  
    76. QuickSearch.OpenQuickSearchCommand()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/QuickSearch.cs:1862
    77. 1860:   private static void OpenQuickSearchCommand(CommandExecuteContext c)
    78. 1861:   {
    79. -->1862:       OpenQuickSearch();
    80. 1863:   }
    81.  
    82. EditorApplication.Internal_CallGlobalEventHandler()
    83.  


    Then it will go crazy with null-refs continuously

    Code (CSharp):
    1. [Exception] NullReferenceException: Object reference not set to an instance of an object
    2. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    3. QuickSearch.SetSelection()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/QuickSearch.cs:901
    4. 899:   {
    5. 900:       var previousSelection = m_SelectedIndex;
    6. -->901:       m_SelectedIndex = Math.Max(-1, Math.Min(selection, m_FilteredItems.Count - 1));
    7. 902:       if (m_SelectedIndex == k_ResetSelectionIndex)
    8. 903:       {
    9. QuickSearch.DrawToolbar()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/QuickSearch.cs:1421
    10. 1419:   if (String.Compare(previousSearchText, context.searchText, StringComparison.Ordinal) != 0 || m_FilteredItems == null)
    11. 1420:   {
    12. -->1421:       SetSelection(k_ResetSelectionIndex);
    13. 1422:       DebouncedRefresh();
    14. 1423:   }
    15. QuickSearch.OnGUI()    Library/PackageCache/com.unity.quicksearch@1.5.0-preview.1/Editor/QuickSearch.cs:808
    16. 806:   EditorGUILayout.BeginVertical(Styles.panelBorder);
    17. 807:   {
    18. -->808:       var rect = DrawToolbar(m_Context);
    19. 809:       UpdateScrollAreaOffset();
    20. 810:       EditorGUILayout.BeginHorizontal();
    21. MonoMethod.Invoke()    <437ba245d8404784b9fbab9b439ac908>:0
    22. MonoMethod.Invoke()    <437ba245d8404784b9fbab9b439ac908>:0
    23. MethodBase.Invoke()    <437ba245d8404784b9fbab9b439ac908>:0
    24. HostView.Invoke()    <f77adbe680d5435ab56e2403863ec057>:0
    25. HostView.Invoke()    <f77adbe680d5435ab56e2403863ec057>:0
    26. HostView.OldOnGUI()    <f77adbe680d5435ab56e2403863ec057>:0
    27. IMGUIContainer.DoOnGUI()    <20eb378634454e3bb04d1f42afb7fb3b>:0
    28. GUIUtility.ProcessEvent()
     
  16. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hmm ok that is not good. We'll check this ASAP. Are you on standard or pro license as it seems to be due to how your user auth token is extracted?
     
  17. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Standard license.
    The issue happened because I was somehow logged out.
    If I login, it works normally.
     
  18. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yes exactly. I have published version 1.5.0-preview.2 which should be available shortly that supports being logged out and still returns asset store search results.
     
    SugoiDev likes this.
  19. seec1

    seec1

    Joined:
    Jun 6, 2016
    Posts:
    11
    Hi all,



    I tried to install Quick Search Preview, but seem not successful.

    This is error:





    UnauthorizedAccessException: Access to the path ".../Library/PackageCache/com.unity.quicksearch@1.4.1/Editor/Providers/SettingsProvider.cs" is denied.

    System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <7d97106330684add86d080ecf65bfe69>:0)

    System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at <7d97106330684add86d080ecf65bfe69>:0)

    (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)

    System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) (at <7d97106330684add86d080ecf65bfe69>:0)

    System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) (at <7d97106330684add86d080ecf65bfe69>:0)

    System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) (at <7d97106330684add86d080ecf65bfe69>:0)

    System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding) (at <7d97106330684add86d080ecf65bfe69>:0)

    (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string,bool,System.Text.Encoding)

    System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) (at <7d97106330684add86d080ecf65bfe69>:0)

    EditorImportManager.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetsPath) (at Assets/Tools Extended/UnityEditor Extended/Common/Editor/EditorImportManager.cs:202)

    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <7d97106330684add86d080ecf65bfe69>:0)

    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.

    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <7d97106330684add86d080ecf65bfe69>:0)

    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <7d97106330684add86d080ecf65bfe69>:0)

    UnityEditor.AssetPostprocessingInternal.InvokeMethod (System.Reflection.MethodInfo method, System.Object[] args) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:652)

    UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:144)





    I using macOS 10.15 Catalina. Unity 2019.1.14f1.

    I guest unity not have permission to access the path. But I don't know how to pass it.

    What should I do now?

    Thanks
     
  20. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Is seems unrelated to Quick Search itself. Do you have the same issue with other packages? Did you try wipe your library folder and re-open your project?
     
  21. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Quick Search 1.5.0-preview.3 is now released.

    Changelog:
    • [UX] You can now search scene objects with a given component using c:.
    • [UX] Update the quick search spinning wheel when async results are still being fetched.
    • [UX] Asset Store provider fetches multiple screenshots and populates the preview panel carousel with those.
    • [UX] Add drag and drop support to the resource search provider.
    • [UX] Add a new settins to enable the new asset indexer in the user preferences.
    • [UX] Add a new asset indexer that indexes many asset properties, such as dependencies, size, serialized properties, etc.
    • [UX] Add a carrousel to display images of asset store serach results.
    • [FIX] Add support for digits when splitting camel cases of file names.
    • [DOC] Document more APIs.
    • [DOC] Add some sample packages to Quick Search to distribute more search provider and query engine examples.
    • [API] Improved the SearchIndexer API and performances
    • [API] Change the signature of fetchItems to return an object instead of an IEnumerable<SearchItem>. This item can be an IEnumerable<SearchItem> as before, or an IEnumerator to allow yield returns of IEnumerator or IEnumerable.
    • [API] Add the QueryEngine API.
    Here's a short video showing the new index being built and the new Query Engine being used to build more complexe queries.



    Let us know what you think of the new index. In Unity 2020.1 and ealier, the index will be built using a blocking progress bar. The asynchronous progress bars are not available yet.
     
    sebastiengrenier and SugoiDev like this.
  22. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    As Jonathan said, we introduced the QueryEngine:

    QueryEngine
    A new feature of quicksearch is the QueryEngine. This QueryEngine lets you do search queries with a syntax similar to Scryfall's syntax (https://scryfall.com/docs/syntax), to filter any data set you have. However, this engine lets you extend the syntax, by defining your own filters, functions and operators.
    TLDR: It lets you do this!



    How it works
    The engine parses an input string and transforms it into a query operation. This query operation can then be applied on any data set (as long as the type matches) to filter it and get only the objects that passes the search.
    In order to properly parse an input string, the engine must be configured properly by adding filters, filter handlers, operators, etc.. To configure the engine, you can use the different "AddFilter", "AddOperator", "AddOperatorHandler", "AddTypeParser", "SetDefaultFilter", "SetDefaultParamFilter" and "SetSearchDataCallback" functions.

    Code (CSharp):
    1. m_QueryEngine = new QueryEngine<MyObjectType>();
    2. // Id supports all operators
    3. m_QueryEngine.AddFilter("id", myObj => myObj.Id);
    4. // Name supports only contains (:), equal (=) and not equal (!=)
    5. m_QueryEngine.AddFilter("n", myObj => myObj.Name, new []{":", "=", "!="});
    6. // Active supports only equal and not equal
    7. m_QueryEngine.AddFilter("a", myObj => myObj.Active, new []{"=", "!="});
    8. // The magnitude support equal, not equal, lesser, greater, lesser or equal and greater or equal.
    9. m_QueryEngine.AddFilter("m", myObj => myObj.Position.magnitude, new []{"=", "!=", "<", ">", "<=", ">="});
    10. // Setup what data will be matched against search words and phrases
    11. m_QueryEngine.SetSearchDataCallback(myObj => new []{myObj.Id.ToString(), myObj.Name});
    Once the engine is setup, you can use it to parse an input string and get a query operation:

    Code (CSharp):
    1. // Parse the query string into a query operation
    2. var query = m_QueryEngine.Parse(inputQuery);
    3. // If the query is not valid, print all errors
    4. if (!query.valid)
    5. {
    6.     foreach (var queryError in query.errors)
    7.     {
    8.         Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, $"Error parsing input at {queryError.index}: {queryError.reason}");
    9.     }
    10. }
    Under the hood, the engine builds a decision graph that will be used to filter the elements. A decision graph looks like this:



    This query can then be reused to filter any data set (IEnumerable<> or IEnumerator<> of the same type as the QueryEngine):

    Code (CSharp):
    1. var filteredDataSet1 = query.Apply(dataSet1);
    2. var filteredDataSet2 = query.Apply(dataSet2);
    3. var filteredDataSet3 = query.Apply(dataSet3);
    What is supported
    By default, the engine supports the combining operator "and" (the default when interpreting spaces), "or" and "not" (can be "not" or "-"), and a multitude of filter operators (contains ":", equal "=", not equal "!=", lesser "<", greater ">", lesser or equal "<=", greater or equal ">="). These operators support some basic predefined types (int, float, bool and object).

    To support more types and operators, you can extend the engine with the functions "AddOperator", "AddOperatorHandler" and "AddTypeParser". Check out the samples for more details.

    The power of functions!
    Most of the filters you will setup will be basic ones, but for more flexibility, you can add function filters. Function filters let you specify a function with a parameter transformer, which lets you do complex operation with some constant data:

    Code (CSharp):
    1. // Add a function "dist" to filter item that are at a certain distance from a position or another item
    2. m_QueryEngine.AddFilter("dist", HandleDistFilter, HandlerDistParameter, new[] { "=", "!=", "<", ">", "<=", ">=" });
    3. static float HandleDistFilter(MyObjectType myObj, Vector2 param)
    4. {
    5.     var vec = myObj.Position - param;
    6.     return vec.magnitude;
    7. }
    8. Vector2 HandlerDistParameter(string filterValue)
    9. {
    10.     // If the user specified a vector
    11.     if (filterValue.StartsWith("[") && filterValue.EndsWith("]"))
    12.     {
    13.         filterValue = filterValue.Trim('[', ']');
    14.         var vectorTokens = filterValue.Split(',');
    15.         var vectorValues = vectorTokens.Select(token => float.Parse(token, CultureInfo.InvariantCulture.NumberFormat)).ToList();
    16.         Assert.AreEqual(vectorValues.Count, 2);
    17.         return new Vector2(vectorValues[0], vectorValues[1]);
    18.     }
    19.     // Treat the value as the name of an object
    20.     var myObj = m_Data.Find(obj => obj.Name == filterValue);
    21.     Assert.IsNotNull(myObj);
    22.     return myObj.Position;
    23. }
    You can then filter your data by using the function:

    Code (CSharp):
    1. var query = m_QueryEngine.Parse("(dist(Mesh 28)<5 a=true) or 42");

    I hope that you can find this useful and have as fun using it as we did creating it.
    Thanks!
     

    Attached Files:

  23. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Awesome work there. Advanced search is very helpful and appreciated, as is performance (always).

    Incidentally, I just noticed typing "?" gives no results. Was this always the case?

    Edit: it worked after restarting Unity!
     
  24. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    We will eventually document all the properties that we index, but here's another example. Lets say you are searching for all textures with width higher than 256 pixels but with an exact height of 256 pixels.

    upload_2020-1-9_16-14-23.png
     
    SugoiDev and sebastiengrenier like this.
  25. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Make sure you have the Help provider activated:

    upload_2020-1-9_16-15-31.png

    upload_2020-1-9_16-15-46.png

    Unfortunately all the new indexed properties are not documented yet, but there a ton of it already! Here's a few examples:

    c:audio -> will find all scene objects that have an audio component
    size>=1024 -> will find all assets that are larger than 1kb
    has:spriterenderer -> will find all prefab assets that have a child component of type SpriteRenderer
    a:packages something -> will find all assets named "something" are are in a package
    something else -a:packages -> will find all assets named "something else" that are not in a package.

    One more:
    t:prefab dep:moon -> will find all prefab assets that depends on an asset named "moon"


    upload_2020-1-9_16-20-51.png
     
    Last edited: Jan 13, 2020
    Peter77, petey and SugoiDev like this.
  26. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Just updated to 1.5.0 and noticed search is a bit strange.

    Here's an example
    screenshot 2020.01.24-00.38.16.png

    screenshot 2020.01.24-00.38.44.png
    screenshot 2020.01.24-00.38.28.png
    My settings:
    screenshot 2020.01.24-00.42.16.png
    screenshot 2020.01.24-00.42.04.png

    Any idea how I'm breaking it?
     
  27. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Your search queries are legit. I'll check this. Meanwhile we usually break file names into many words so MonitoredAssets.asset will be 3 words "monitored", "assets" and "asset", if you type "monitored a..." does it give you some result?

    On my side, I'll double check that we also generates words for complete filenames so "monitoredassets" is also a fully searchable word.

    I'll get back to you.
     
    Last edited: Jan 24, 2020
  28. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    "monitored a" matches nothing, but "monitored as" matches properly.
    Maybe a single letter does not trigger the matcher (I didn't look at the code yet). But it is still considered, seeing as "monitored" matches, but "monitored a" has no results.

    Thanks for looking into it!
     
  29. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Last edited: Jan 24, 2020
    SugoiDev likes this.
  30. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    Two more suggestions from me:

    Not sure if this has been/being considered already, but would it be possible to add multi-selections to quick-search? It could work like it does in most softwares (e.g. Windows File Explorer) where there is a cursor that you can move separately by holding CTRL and using SPACE to toggle selections, and holding shift to select sequential entries. I'm trying to replace the hierarchy search bar with Quick Search now that I've noticed it shows you the entire path to a game object (MASSIVELY useful) but I often want to filter and select several objects to modify them after in the inspector.

    Additionally would it be possible to offer some shortcuts to allow using Quick Search without arrow keys? Vim users (myself) would appreciate CTRL-P (previous) and CTRL-N (next) to move up and down, and TAB for the menu instead of ALT-RIGHT. Usually I hate requesting use-case specific features like these, and having these shortcuts mappable in the Unity Shortcut Manager would in theory be a good solution for all users, but it seems it does not currently allow more than one shortcut per action and personally I'd still like UP/DOWN to be available as an alternative.

    Also, awesome development going on here with the filtering, wow! Keep up the great work guys, it's nice to follow the progress on this. I have a question about the indexing feature: once it's built once initially, does it get updated incrementally as new assets and changes are made to the project?
     
  31. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    That is something we have been discussing and want to do. We just need to make sure that we apply the actions correctly to all selected items when that happens, but each search items can a different set of actions. That said, that is something that should be available sooner than later.

    This has been asked more than once, so I think it is time for us to do it! I'll some new shortcut entries (>=2019.2) for those so you'll be able to tweak them as you prefer.

    If there is no bug ;) the index should get updated when assets on disk changes. It is possibles that the index gets refreshed only a few seconds after the asset actually changed, so it is not instant, but at most, after 1-10 seconds the index should be updated and the search results should get updated. It is possible you need to close the quick search window and re-open it to get the update.
     
    oxysofts likes this.
  32. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    This issue will be fixed in 1.5.2-preview.1 and 1.6.0-preview.1
     
    SugoiDev likes this.
  33. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    The particular situation I mentioned seems to be fixed (2 tokens), but this very similar one (3 tokens) is still present in 1.5.2-preview1

    Matches nothing
    gameflagsm
    gameflags m
    gameflagsma
    gameflags ma

    Matches properly
    gameflags ma
    game flags ma

    screenshot 2020.02.11-00.20.41.png
    screenshot 2020.02.11-00.13.26.png
    upload_2020-2-11_0-20-8.png
     
  34. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yeah for memory reasons, we were capping the max. variation indexing of words up to 8 characters. We have bumped it to 16 for next release. That said, we favor search queries to be splitted into many words. It has many benefit. First, you do not need to type all words. In your case, you can simply type `GFM` or `gam fla mana` and it should give you similar results. Seconds, typing more words will also speed up the search (at least for very big projects). Finally, bumping the max variation should fix it for most cases.

    One last thing, in next release 1.6.0, you'll be able to setup your own indexes and choose exactly what you want to index:

    upload_2020-2-12_20-19-49.png

    upload_2020-2-12_20-21-45.png

    upload_2020-2-12_20-24-52.png

    upload_2020-2-12_20-28-5.png

    The new .index file are json based and can be edited manually.
    upload_2020-2-12_20-28-51.png

    When an asset index gets built, the generated artifact gets managed by the asset database and can be shared using the cache server.
     
    SugoiDev likes this.
  35. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    I just noticed a severe performance hit with 1.6+ (tested on both preview 1 and 2 and it's the same)
    Tested on 2020.1.0a23 and 24. It seems to be worse in 24 (about 2x worse), but might be unrelated.

    I couldn't save the profiler output because it's too big and Unity crashes. Even in the when not in deep-profiler mode, the frame is >2GB and can't be saved.
    The issue is triggered when using AssetDatabase.SaveAssets() after dirtying a ScriptableObject.

    Using "File" or "Complete" in the settings has no impact on this. Even using "no Indexing" had no impact.


    Here's the importer inspector
    upload_2020-2-23_2-58-28.png
    And its data
    Code (JavaScript):
    1. {
    2.   "roots": ["Assets"],
    3.   "directories": false,
    4.   "includes": [],
    5.   "excludes": ["Temp/"],
    6.   "options": {
    7.     "fstats": true,
    8.     "types": true,
    9.     "properties": false,
    10.     "dependencies": false,
    11.     "nestedObjects": false
    12.   }
    13. }

    Here's some profiler screenshots. That 41s is exaggerated because of the profiler itself. When not profiling,it takes about 10s. That ram usage I think is real because it is like that even in non-deep profiling mode.

    screenshot 2020.02.23-02.54.25.png
    screenshot 2020.02.23-02.53.52.png
     
    Peter77 likes this.
  36. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi, actually before we were only indexing the asset file paths in another thread. Now we indexes many asset properties using the AssetDatabase API which needs to run in the main thread, so it takes more time, but usually this is only done once and then we do incremental updates.

    If you do not want all that indexing, you can go back to Files indexing which is still being done in another thread, but you won't get all the benefits of the asset property indexing.
     
  37. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    I'll try to run a few tests, but I can't seem to repro the issue using 1.6.0-preview.2. If you ever have a sample project that repro this issue, please share it.
     
  38. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    I have moved UpdateIndexes for incremental updates to another thread. Please let me know if it is better. Since the asset database is single threaded when importing assets, I cannot move the LoadBytes into another thread when called from AssetTracker.AssetsImported. I was told that a new AsyncImporter will be available soon, so when it is, I'll switch to that.

    Build 1.6.0-preview.3: https://drive.google.com/file/d/1gJIXl1LefAAbvLKYI8ZnqATaMGykwHKE/view?usp=sharing
     
    Last edited: Feb 24, 2020
    SugoiDev and TextusGames like this.
  39. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Massive improvement. Not seeing the "hold on" boxes anymore, so it's a delay of under 1s.
    Did a quick profiling and it takes 500-800ms now (still see a flash of the hourglass cursor).
    Still a lot slower than before 1.6, but already good enough to use, I think.

    The loading is what takes the time now, so we'll have to wait for the AsyncImporter.


    Thanks!
     
  40. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yes indeed, as we index a lot more data. You can edit the "excludes":["Vendors/", "External/", ".huge_file_extension"] field if you want to exclude certain files types or folders to build the index faster and reduce the amount of incremental updates. You can also have many indexes. In example, you could create an index for scripts, one for textures, etc. To do this, you can in an index file set "includes":[".png", ".psd", "Art/Images", "etc."]. Also note that you can edit the "roots":["Assets/From/Here", "Assets/From/There/Too"] to explicitly define from which root folders the index should get stuff.

    This stuff is still under development so do not hesitate to provide any feedback. Eventually we'll have an UI to edit the JSON data.

    I'll push 1.6.0-preview.3 soon this week.

    Thanks for your great feedback. It is really useful for us to make Quick Search a great tool.
     

    Attached Files:

    SugoiDev likes this.
  41. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Incredible feature!

    I'm gonna start using it right away, as I have some folders that have thousands of files inside that I don't even want showing up in the search at all.


    The examples were very useful, thank you.


    Related question: Is there a way to search only in a specific index?
     
  42. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Just noticed that it seems roots and includes/excludes have different "base".

    With roots, for a folder in Assets/MyFolder, just "MyFolder" doesn't work, while "Assets/MyFolder" does.
    But, with excludes, both "Assets/MyFolder/" and just "MyFolder/" work.
    From what I read in the code, excludes goes through PatternChecks(), while roots is just "StartsWith".

    Is that correct?


    Incidentally, is there a way to see info on the created indexes, or is the info lost because they are all baked into a single index?
     
  43. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    By the way, I'm already abusing this feature and it seems to be holding just fine so far.
    Great stuff.
     
    jonathans42 likes this.
  44. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yes you can type a:<index name>, i.e. a:scripts

    upload_2020-2-24_16-14-5.png

    You can also scan available keywords by selecting the index asset and expanding Keywords (careful if you have too many, the inspector won't like it!"

    upload_2020-2-24_16-15-29.png
     
    SugoiDev likes this.
  45. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yeah currently, roots need to be full paths, i.. Assets/..., Packages/...

    includes and excludes can be a folder, an extension or a filename.
    - Starting with a dot, i.e. ".cs", will match all **/*.cs files
    - Including a /, i.e. "Temp/" will match any folder containing *Temp at any level
    - Everything else (not starting with a ., or ending with a /), i.e. "__SECRET__", will match any files that contains __SECRET__ in their filename.

    We might add more wildcards overtime.
     
    SugoiDev likes this.
  46. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    So if you want to do a search for a specific index, you'll do something like this:

    upload_2020-2-24_16-21-44.png

    This will search all assets indexed by Prefab.index (currently only indexing ".prefab" files) but excluding those containing tile and those for which the path (path: is the string before the filename, i.e. Assets/Examples/...) contains Examples.
     
    SugoiDev likes this.
  47. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Awesome!

    Is there a property in the json to define the name of the index, or does it just fetch from the filename?
    a:ScriptableObjects is a mouthful (handful?), but renaming the file itself to SO.index seems a bit weird.
     
  48. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Really digging the "intellisense" help/completion of the entries!

    Incidentally, the console juts spewed a few "Scope was not disposed! You should use the 'using' keyword or manually call Dispose. UnityEngine.Scope:Finalize()" while I was quickly changing my search terms to see the options.

    Might be just Unity breaking itself as usual, but I decided to mention in case it rings any bells to you.
    (I'm on a24 right now)
     
  49. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Is there a way for an index to be "folders only"? Something like "files": false
    My use-case is that I want to give specific score to folders.
     
  50. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Right now it is fetched from the file name, but it is a good idea to be able to override it using a field in the json data. I'll add this tomorrow.
     
    SugoiDev likes this.