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.

Search by type? What are the possible values for 'type'?

Discussion in 'Editor & General Support' started by komatii, Oct 11, 2011.

  1. komatii

    komatii

    Joined:
    Sep 8, 2010
    Posts:
    58
    In the project search box, there is the option to search by "type". But I can't find any documentation on what the valid values for type are?
    I'm trying to get all of the .unity files and put them in their own folder, since "file open scene" does not filter to just .unity files and typing *.unity into the file name box doesn't filter like other windows apps.
    I've tried typing "unity" and "scene" into the search box, set to type, but that gets me nothing. "Shader" gets me shaders, but what is the type for a scene? Is there a list of all types somewhere?

    komatii
     
  2. Greymarch

    Greymarch

    Joined:
    Jun 7, 2007
    Posts:
    106
    I would love to know this as well. Things that seem obvious and needed like "prefab", "scene", "level", "object", "fbx", etc. do nothing. I'm trying to get all the root mesh objects (by type) so that all fbx import settings can be changed at once, but "mesh" and "object" give me too much other stuff to pick through ("gameobject" comes closest listing prefabs and base meshes).
     
  3. Mr.T

    Mr.T

    Joined:
    Jan 1, 2011
    Posts:
    546
    Ok other than the one you mentioned, I found a few types by trial and error. So far I can't find a list anywhere.

    So far we have

    Object
    Shader
    Material
    Texture
    Font
    Flare
    Cubemap

    Thats as far as I was able to check. You are right no way to search for scenes
     
  4. Greymarch

    Greymarch

    Joined:
    Jun 7, 2007
    Posts:
    106
    Great... even worse.. some things that work in Hierarchy don't work in Project search and vice versa :p So some others that work (still all by type):

    gameobject - gives prefabs and root mesh/object files
    terraindata - in project view, just terrain in hierarchy
    light - only in hierarchy view
    animation - only in hierarchy ? lists anything with an animation component attached
    collider - only in hierarchy ? lists anything with a collider (any type) component attached
    renderer - only in hierarchy ? lists anything with a renderer component attached
     
  5. Screenhog

    Screenhog

    Joined:
    Jul 2, 2009
    Posts:
    497
    Most components work pretty well, in my experience. I've even typed in a name of a script to find all objects that use that script. AudioSource is another useful one for me.
     
  6. ChrisYum

    ChrisYum

    Joined:
    Jun 29, 2012
    Posts:
    1
    I too am a little surprised at how useless the type feature seems to be. I got it into my head that it would be useful to have multiple Project views, each with different types of things and so tried to use this option, but my first attempt was for a "script window" and so far I can't find its 'type'. So I too would like this improved and/or made more transparent.
     
    MilenaRocha likes this.
  7. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    In general, the "type" is the corresponding class name in the scripting API.

    So, want all scripts? "MonoBehaviour" is the type. All textures? "Texture". Prefabs? "GameObject" (since a prefab is a game object asset).

    This will be more intuitive (and changed quite a bit) in Unity 4.
     
  8. MajorMcDoom

    MajorMcDoom

    Joined:
    Nov 27, 2012
    Posts:
    13
    Sorry to revive an old thread, but I just tried searching by type, and literally nothing works. My scene's got hundreds of objects in it, with a variety of scripts. This happens whether I'm searching by Type or by All. I'm using Unity 4.0.0f7.
     
  9. MikeBastien

    MikeBastien

    Joined:
    Apr 24, 2009
    Posts:
    139
    Project:

    1. If you just type a string, it will return the name of any corresponding item in a drill-down fashion.
    2. If you look to the right of the search box, there is a drop-filter list that will do it per-type.
    3. You can combine the two as well so:

    a: Typing myStuff will return any mesh, texture, script etc., containing that anywhere in its name.
    b: Typing t:scene will return all scenes in the project (which is what using the pre-made filters do).
    c: Typing t:scene myLevel will only show any scenes that are named MyLevel.


    Hierarch:

    1. A string search returns object names similarly as will the Project Brower (updating as you type).
    2. You can also search by type too, and you'll probably get renderers and other root components. However no results on the actual textures or shaders they use.
    3. If you are searching for a script, the whole name has to be entered before it will show up unfortunately.

    More importantly... for whatever reason the Hierarchy is case sensitive, whereas they Project Browser doesn't appear to be.

    I'll file a bug on it next week.

    Here's a link to the docs:
    http://docs.unity3d.com/Documentation/Manual/ProjectView40.html
     
    OmarVector likes this.
  10. MajorMcDoom

    MajorMcDoom

    Joined:
    Nov 27, 2012
    Posts:
    13
    Thanks for the reply, Mike.

    I see, I was just confused because it worked differently in the previous version I was using. I think it was 3.5 or 4.0 beta. I would just have to start typing my query in the Hierarchy, and results would start coming in, kind of like Google searches. This worked for search by Type as well. Was it a deliberate decision to make it so that you have to type the whole name of a script, and without any spaces? It just seems a little counter-intuitive to me, that's all. The old system worked really well for me.

    More details:

    I have to type out the whole name of any component I'm looking for before it will show up, not just for scripts. This applies to Renderers, Transforms, etc. Also, searches for default components are not case-sensitive. Only searches for scripts in the Hierarchy are case-sensitive.

    Hope that helps. Thanks!
     
    Last edited: Dec 1, 2012
  11. Skyblade

    Skyblade

    Joined:
    Nov 19, 2013
    Posts:
    76
    How can I find all Box Colliders in Hierarchy view?
     
  12. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Type "t:BoxCollider" in the search field.
     
    nirvanajie, twobob and Skyblade like this.
  13. Skyblade

    Skyblade

    Joined:
    Nov 19, 2013
    Posts:
    76
    Oh, sweet, I need to type it fully, not partially! I typed "Box", "Coll" and did not understand why it is not working :)
     
    BackgroundMover likes this.
  14. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    gonna revive this old thread. In Unity 5.1.1p2, I just noticed t:MeshFilter & t:MeshRenderer (or just t:Renderer) do not produce any results.

    Is there a behind the scenes name I should be using?
     
  15. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Hey, right now im trying to write a script that finds all of the different 'Types' in a project for me to pick from in a ui dropdown box... Is what i am trying to do impossable?
     
  16. xhonzi

    xhonzi

    Joined:
    Apr 2, 2013
    Posts:
    205
    t:renderer works.

    Also, you can search for material references like this:
    ref:relative/path/from/assets/to/material/material.mat

    or a mesh like this:
    ref:relative/path/from/assets/to/mesh.FBX

    And probably a couple others.
     
  17. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    It does now, in 5.3.4. Was broken before. Works with MeshRenderer and MeshFilter too now.
     
  18. jknight-nc

    jknight-nc

    Joined:
    Jun 10, 2014
    Posts:
    52
    how can i search for all .blend files?
     
    hsgaminators likes this.
  19. xhonzi

    xhonzi

    Joined:
    Apr 2, 2013
    Posts:
    205
    In the scene or in the project? In the scene, I don't think you can- however they should all be t:renderer. In the project, they would be t:mesh. Which will return more than .blends, but hopefully is closer to what you need.
     
  20. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,103
    t:model works, though you'll get all .fbx files as well as .blend files, if that matters.
     
  21. jknight-nc

    jknight-nc

    Joined:
    Jun 10, 2014
    Posts:
    52
    thanks for the t:model hookup.

    Should be able to search by file extension.
     
  22. Naphier

    Naphier

    Joined:
    Aug 4, 2014
    Posts:
    114
    Anyone know if there's a way to do a hierarchy search on tags (not asset tags, project tags) or layers?
    Thx
     
  23. PedroGV

    PedroGV

    Joined:
    Nov 1, 2010
    Posts:
    415
  24. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    Is there any detailed documentation for the hierarchy search? I can't find anywhere in the docs that mentions t:, ref:, etc, and I'm hoping there are more options. For example, I'd love a search that only returns active objects in the scene.
     
    Folstrym and twobob like this.
  25. Naphier

    Naphier

    Joined:
    Aug 4, 2014
    Posts:
    114
    Not really, I mean there's nothing on this. Basically it looks like searches are just modifyable by the same things that buttons in the search bar do. I guess we really need an extension for this. There's one out there for searching for references to an asset. Might be a cool idea to extend that further with some regex searching or at least some conditional searching. Amazing that Unity hasn't implemented some better searching tools.
     
    twobob likes this.
  26. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    There's more than just the buttons in the search bar, because there's no button for searching by reference, like ref: does. So the search might be able to do a lot more than we know about.
     
  27. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,304
    I'm trying to export all my Assembly Definition files. That would be trivial if I could do something like t:AssemblyDefinitionFileImporter or whatever. Unfortunately, this doesn't quite seem to work. I'm not even able to find the type of assembly definition files. I can't do a simply *.asmdef (which would be the most obvious and easy way to search for these files).

    Is the Unity Project Browser really getting no love at all?
     
    a436t4ataf, _watcher_ and Noisecrime like this.
  28. _watcher_

    _watcher_

    Joined:
    Nov 7, 2014
    Posts:
    243
    @jashan same problem here. I've read somewhere, that you can search by extension, but docs don't have that information. Search by extension seems like a logical thing to have.
     
    carpedm20 likes this.
  29. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,103
    The type of assembly definition files in the editor is AssemblyDefinitionAsset, so "t:AssemblyDefinitionAsset" works.

    Edit: but, yeah, file extension is obvious and should be supported.
     
  30. _watcher_

    _watcher_

    Joined:
    Nov 7, 2014
    Posts:
    243
    This is great, why is it not in here tho? Thanks Baste, i can finally remove the "Assembly_" prefix from my Assembly Definition asset filenames x).
     
  31. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,103
    You're asking me? I could ask you the same thing!

    The really dumb thing is that AssemblyDefinitionAsset inherits from TextAsset, and has no methods or fields. The natural thing would be to allow for editing the asmdef files from script, but the best way to do that now is to create a type with the same fields as the .asmdef files have, and parse the file with JSONUtil.
     
  32. _watcher_

    _watcher_

    Joined:
    Nov 7, 2014
    Posts:
    243
    ^ this made my day XD
    thanks again))
     
  33. unity_Vf94ggq9R0gE7w

    unity_Vf94ggq9R0gE7w

    Joined:
    Sep 26, 2018
    Posts:
    2
    thnx
     
  34. AdamKane

    AdamKane

    Joined:
    Dec 3, 2012
    Posts:
    134
    How to search for .DLLs, for example:

    t:Managed or
    t:ManagedPlugin or
    t:DLL or
    t:plugin or
    t:DynamicallyLinkedLibrary

    thanks.

    Hmmm... not sure why the capital letters are showing as emoji
     
    travelhawk likes this.
  35. GuidewireGames

    GuidewireGames

    Joined:
    Apr 20, 2017
    Posts:
    18
    I really want t:Audio
    Why doesn't this exist?
     
  36. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,304
    It does. But the type is AudioClip, not Audio. So it's t:AudioClip.

    And the forum software apparently doesn't know that :D and :p will usually have spaces before and after, so it converts those also when the appear inside of words, like t:DLL or t:plugin. Let's see if wrapping it in a code snippet fixes that:

    Code (CSharp):
    1. t:DLL
    2. t:Plugin
    EDIT: It does ;-)

    EDIT2: Let's see if this also works with inline code:
    t:DLL


    EDIT3: It does, too ;-)
     
  37. TheElumenati

    TheElumenati

    Joined:
    Jan 22, 2014
    Posts:
    33
    Is it possible to filter by ScriptableObject, or a specific type of ScriptableObject?
     
  38. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,103
  39. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,797
    2020 ... we still don't have file-extension searching?. Has anyone found a way to do file-extension searches, considering the project view is a list of files?

    (I have a wayward C# project file somewhere in my project, that's confusing Unity's VS integration. It's quite likely a .sln or .csproj or one of the other many VS files has somehow crept in. So ... i try to search by type to find it.)
     
  40. pantang

    pantang

    Joined:
    Sep 1, 2016
    Posts:
    187
    Does anyone know if its possible to search mesh renderers using a specific mesh? say I want to find a renderer using a mesh named mymesh?

    Ive got a couple large objects I need to find and its been bugging me for weeks, would be easy id exported the meshes but they are unsaved probuilder ones so can just go to its folder either :(
     
  41. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,304
    You could write an editor script that iterates over all scenes and all prefabs in the project and then logs those gameobjects / prefabs that use that specific mesh (the mesh is actually in the Mesh Filter, not the mesh renderer but that's just a small detail to be aware of).

    Depending on your project, you might actually get away with just doing it for the currently loaded scene (and then doing it manually for all relevant scenes).
     
    pantang likes this.
  42. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,797
    Related: there is a "secret" API that is much, much better for doing this stuff, but Unity has officially decided we're not allowed to use it (I discovered it, filed a bug asking them to make it public, and got rejected: https://forum.unity.com/threads/bug...-internal-preventing-us-from-using-it.971961/ )

    I haven't tried doing extension-searches using the hidden API, but it (SearchFilter) appears to be what's providing the string-based searches we see here (AssetDatabase currently has no methods for Find'ing assets - they're all hidden inside the private API (you could get them with reflection, but...) - instead you have to convert your method calls into string values and send them through the same string-parser that the Editor windows are using in this thread. Ugh)
     
    Ziplock9000 likes this.
  43. lukicamukica

    lukicamukica

    Joined:
    Feb 11, 2016
    Posts:
    8
    There exists, for some years already. It's called QuickSearch. Here's a link to the package manual: https://docs.unity3d.com/Packages/com.unity.quicksearch@2.0/manual/index.html
     
  44. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,797
    I read the docs, twice. Found nothing that said it allows search-by-type. Can you be more precise?
     
  45. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,103
    search-by-type has always been available, that's t:typeName. Works both in old search and quick search.

    Quick Search also supports regex, so I'm pretty sure *.txt should work as expected.
     
    lukicamukica likes this.
  46. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,797
    Well, yes, from context, I meant "file type" not "C# subclass"

    Anyway, QuickSearch doesn't appear to work :(. Trying to open it right now in Unity Editor LTS triggers 85 compile errors and then permanently fails, the feature cannot be used (just generates compile errors on Unity's own code) :D - this is apparently not a production-ready feature.
     
  47. cdr9042

    cdr9042

    Joined:
    Apr 22, 2018
    Posts:
    146
    is there anyway to search for .unitypackage file? I'm trying to import a package using Editor script. And I need to get the path to the package

    AssetDatabase.ImportPackage(package, false);
     
  48. X3doll

    X3doll

    Joined:
    Apr 15, 2020
    Posts:
    29
    Sorry for the Necro.

    I can confirm that even today (29/03/2023, 2021.3.10f1) is not actually possibile to search by file type.

    Example, i was writing my cool localization tool and i'm in need to find a specific extension in my editor files.

    Using AssetDatabase, you have to use the editor filters like these:
    https://docs.unity3d.com/Manual/search-additional-searchfilters.html

    Funny Thing Part 1)
    upload_2023-3-29_16-38-4.png

    It doesn't work as is, documented. Is quite subtle, but YOU NEED and to specify a Unity Object ;)

    Funny Thing Part 2)
    Ok you need to specify a Unity Object. Ok let be TextAsset. Well you know? Is not a Unity Object as Texture or Model or Material :)

    Maybe i should write my AssetDatabase extensions method to retrieve files info in editor using System.IO
     
  49. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,797
    I'm not sure what you're trying to do, but it should be working. Did it not work when you specified "TextAsset" as the type?

    I wrote a version that uses reflection to uncover the API the Unity staff refused to let anyone use (if your case is extreme, I'd recommend doing that - you have to decompile the FindAssets method calls and see how they work internally, and then use Reflection to improve on them), but mostly I have simple cases these days where I just use wrappers like this one: https://github.com/adamgit/Publishe...WorkaroundUnityMissingAssetDatabaseFindAPI.cs
     
  50. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    74
    That documentation is for the "Search" window (Ctrl+K). It has a more powerful set of filters than the Project Browser. The Project Browser can be configured to use the Search backend by going into "Preferences/Search/" and setting the Project Search Engine to "Advanced":
    upload_2023-4-3_13-40-15.png
    However, if you would like to continue using the classic search engine for the Project Browser, you can use the "glob:" filter to filter by file extension:
    glob:"*.png"
     
    a436t4ataf likes this.