Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Feature Request Project Window Search. Filter by Directory

Discussion in 'Editor & General Support' started by illinar, Dec 24, 2020.

  1. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    857
    On the one hand I can't believe this is not supported (unless I missed it), on the other hand this is the first time I ever really need it.

    I really need right now to get all the files of a certain type in a certain directory and only that directory.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,711
    What filetypes? There are filter predefines in the Unity Project window top bar.

    If you want to find specific assets of your own, such as ScriptableObject instances, just search it with t:

    Code (csharp):
    1. // when you make instances of this:
    2. public class FooBar : ScriptableObject {}
    You can see them all in any given directory (or the whole project) with
    t:FooBar
    in the upper corner
     
  3. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    857
    Does it matter what file type? I'm talking about directory filtering. I haven't found a way to do that. I need all images from a folder and it's subfolders.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,711
    I don't think Unity's project window does that. I have seen project searchers such as "find unused assets" that give you a new kind of filtered project window where you can select the individual objects. Maybe you could hack one of those to search a type in a folder.

    You could also do it clumsily with source control: delete everything else but that folder, operate on the folder contents, restore all the rest. Awkward and not useful if you're trying to drag those things you want into something else that is now deleted. :)
     
  5. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    228
    According to Unity's documentation you can search recursively within a folder. It took me awhile to figure it out but you first have to type in what you want in the Search Bar (Project Window). Then, under that search bar some clickable words magically appear underneath:

    Search: All In Packages In Assets 'SelectedFolderName'

    Just click on 'SelectedFolderName' and it will lock your search to that folder (and all children). As you click around on different folders, it will automatically search in those folders for the words you typed in the Search Bar.

    If you combine that with types e.g. "floor t: Prefab" then it will search for all Prefabs with those keywords within the selected directory and its children.
     
  6. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    77
    Man, I so wish I could understand what you mean here, but I don't...

    I don't know what you mean by clickable words magically appearing.
    How would I go about seeing all the png-files recursively placed under the folder "Assets/MyFolder"?

    Thanks!
     
  7. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    228
    No worries it took me awhile to figure it out myself.

    First, in your Project tab, click on the folder where you want to search. Then, type some text that is contained in the filename(s) in the search bar:


    Then "magically" this list appears under your text where you can select where to localize the search. Optionally, to the right of the text search bar, if you click on the "tag" icon it shows file types you can also filter by - unfortunately you can't filter by PNG, that doesn't seem to be available in the filter list (I also wish Unity would add Assembly References).
     
    spider853 and Eristen like this.
  8. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    77
    Thank you for your super quick answer!
    Unfortunately, no list of clickable words appears after writing a filter, at least not in Unity 2021.3
    All I can do is to select to filter by texture (which adds "t:Texture"), but nowhere can I specify that the search should apply only to the selected folder.
     
  9. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    228
    btw I'm using Unity 2021.3.12f1 - maybe you have some other setting enabled that disables that? Did you try reading through the documentation I linked at the top? It's fairly decent.
     
  10. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    77
  11. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    87
    Hi! Can you check if you could have enabled the "Advanced" search engine for the Project Browser by any chance? Look into "Edit/Preferences" and then "Search".
    upload_2022-10-31_18-25-34.png
    There is an issue with the "Advanced" search engine where the "All", "In Packages", "In Assets" and "Folder" don't show up. It has been fixed but not backported to 2021.3 yet.
     
    glenneroo and kloot like this.
  12. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    77
    Yes! That was the issue - thank you both for your quick help!
     
  13. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    69