Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Experimental Dependency Viewer

Discussion in 'Editor Workflows' started by sebastienp_unity, Aug 19, 2021.

  1. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Welcome to the Very Experimental Dependency Viewer discussion thread. You can use this thread to ask for help, share feedback, and have discussions about the search-extensions package and its new Dependency Viewer tool.



    Introduction
    Lots of users have expressed a need for Unity to provide a built-in Dependency Viewer. There are some good packages on the Asset Store offering this kind of functionality but it would be better if it was part of the core workflows of Unity.

    Using the Search backend we have been able to build a new Dependency Tool and a Dependency Search Provider. This tool tracks the global selection and shows which assets or GameObjects are Using or are Used by any selected objects. You will also have access to a series of Reports exploring the dependency Graph of your project (Unused assets, broken dependencies, Most used assets...).


    Resources

    Requirements

    The Search Extensions package will work with Unity 2020.3 and any other versions higher than 2021.2.
    • If you are using 20.3: also install the com.unity.quicksearch@3.0.0-preview.14 package.
    • If you are using 21.2+ : Search extensions will use the built-in Search framework and do not require any other package.

    Getting started
    1. Installation instruction for Search Extension package are here.
    2. Go into the Window->Search->Dependency Viewer menu.
    3. Opening the Dependency Viewer for the first time will start building the Dependency Database. This process is asynchronous and is generally not too long (it depends on the size of your project).
    4. When you see the message : Dependency indexing took 2188.93 ms and was saved at Library/dependencies_v1.index in the console you are good to go!
    5. Each time you will select a new Asset or GameObject the Dependency Viewer will display the dependencies of the selected object.
    6. This section of our documentation wiki explains in greater details what the Dependency Viewer is capable of.
    Here are some links to nifty features of the Dependency viewer:

    Current state
    The tool is current in early alpha. Some clients have played a bit with it but we want to gather more feedback on usability, performance and stability. Some current limitations are:

    • There is not incremental update of the Dependency Database. If you want to update the dependencies you have to manually clicked the Build button.
    • This is a Dependency Viewer and not a Dependency Manager. This means you can reason about your project and better understand the links between assets but we have not build workflows to act on this information (no asset mass replace and no ways to easily fix broken dependencies).
    • We only show direct dependencies. That is dependencies at a single level deep of the selected assets.

    What's next

    We want to know from the community if the current tool provides value. Then we want to improve the tool according to the feedback we will receive. Some features we are thinking about:
    • Incremental update of the Dependency Database.
    • Allow users to register custom Dependency indexer
    • Add new dependency reports (like Build dependencies)
    • Add more filtering options
    • Add Depth slider to show dependencies that more than a level deep from the selected object.
    • Add more advance workflows to manipulate Dependencies:
      • Mass replace of Assets
      • Helper to fix broken dependencies
      • Safe Delete of unused assets


    Feedback
    In terms of feedback, we're especially looking for:
    • Can you think of any use cases that are not covered yet?
    • Are there any workflows that are unclear or missing?
    • Are there any issues or unclear parts in the documentation?
    • Is the Dependency Database accurate: are there dependencies that were not found?
    • Any feedback on usability and performance.
    Please share your feedback in this thread.


    How to report bugs
    Since the feature is heavily in development if you find a bug, please log it using the Issue section of our Github project.
    • Attach a (stripped) project when there are issues.
    Have a look at this page for more information and best practices around bug reporting.

    Thank you for your interest, we're looking forward to your feedback!
     
  2. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    First feedback: really nice first version!

    I have listed unused assets in the dependency viewer and now I want to select multiple assets from that list in the project window in order to perform an action on them ( delete or move )
    But when I right click > select it only selects one asset in the project browser

    I know its not a smart thing to delete all unused assets but its just an example of multi-select from list and synchronise selected items in the project window

    Alternatively allow deleting multiple selected assets from disk via the decency viewer

    --------------

    One thing that may be nice in order to see if there are referenced assets inside a folder in the project window,
    is to have an indication of used count on the folder of all items inside the folder.
    or some other indicator that it contains referenced items.
    This way I can quickly see in the project window if a folder is empty of referenced items or not.

    Or just an 0 next to the folder when there are no referenced assets inside the folder
    Then I know if there is not a zero by the folder that there are items inside that are referenced.
     
  3. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,106
    Looks good for start thanks :)

    Questions/Propositions:
    - may be source assets size is important but in my experience I mostly dont care about source assets size and care vary much about imported assets sizes. So I need column for Imported Assets sizes.

    - Looks like you develop yet another way to track dependencies in project and it again have nothing to do with real dependencies that will work upon pressing build button. Am I wrong?

    - I want to select scene and see all textures, meshes and sounds that it depends on and their imported sizes that I will have in player if unload all and load only this scene. How can I do this?

    - will be very good to select scene and see all shader variant dependencies in it? and imported size of every shader variant and sum of ones.

    - one of hard questions in project is why this asset actually goes into build? Want to select asset and see path to root scene/scenes or other assets that act as root in real build asset collection process. So I can see all resource why asset was added to build
     
    Ruslank100, jonathans42 and Neonage like this.
  4. MechaWolf99

    MechaWolf99

    Joined:
    Aug 22, 2017
    Posts:
    293
    This is looking good so far. Most of my feedback is probably not what you are looking for, but I will give it anyways just in case.

    - I already know the answer, but it would be really nice if the window was made with UITookit instead of IMGUI. It gives developers a lot of power to be able to add functionality to the window, or even change how parts work which is just not possible with IMGUI. Even if it takes a bit of reflection, just having that possibility is very nice.

    -Since this is just experiment I'm sure you would get to it anyway. But please use toolbar styling for the header/toolbar. I figured there is at least a small chance that you wouldn't change it, so I wanted to make sure that it was said.

    - When selecting on of the items in the window, I find that I just want to see the the dependency info for that object, and maybe the inspector for it. But the project browser's view goes to it, losing my place and expanding a bunch of folders. So it would be nice if selecting an item wouldn't move the browser view, or at least an option to not.
    (I understand the project browser's view is tied to selection, but I thought it was still worth mentioning)

    That is all I have for now (I also agree with what others have said). I know it is just nitpicky stuff or out of scope, but there it is. I look forward to seeing further development!
     
    jonathans42 and Neonage like this.
  5. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    That is not the goal short term, but clearly something we need to do medium/long term in collaboration with the UITK team.

    Good point. Once we have a good idea of the direction the tool will take, we'll work with a UI designer to standardize and cleanup the UI.

    We can make the Ping object optional, this way it doesn't change the selection or project view. Also we eventually want to have the inspector show more dependency info.
     
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    Yes optional ping may be good to have, so not loose the current selection.
    And if you can still show the inspector without ping that may be a good thing too.
     
  7. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    What do you think if I reuse the same search tracking preference for the dependency viewer. Would that make sense? If this option is turned off, no ping occurs when the selection changes.

    upload_2021-8-23_9-39-15.png
     
  8. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    I have added a way to see the object runtime size (if available and computable) compared to the asset file size.

    upload_2021-8-23_9-55-21.png

    This column take a bit of time to compute per asset, but it can be useful to figure out if an asset takes a lot of memory at runtime.
     
  9. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    Runtime Size is very welcome indeed. Thats a great addition.

    For the preferences I would just add a new line with "Track the current selection in the Dependency View"
    Or if you want to keep it a single checkbox :" Track the current selection in the Search view & Dependency View"
    So that it describes what it affects in detail.

    And for me Folder indicators to show if they are empty would be a big help as I'm trying to use it to clean a project.
     
    jonathans42 likes this.
  10. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Hi Lars would you clarify what you mean with emtoy Folder indicator? Are you saying folder shouls be displayed in the Dependency Viewer and have a special badge if they are empty?

     
    Lars-Steenhoff likes this.
  11. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    In the project window it could just show 0 next to it when its empty of referenced items
    ( they can still be full of non referenced items )

    I don't mean in the dependency viewer

    referenced.png
     
    Last edited: Aug 24, 2021
  12. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    All good! I understand :) We will take notes on this.

     
    Lars-Steenhoff likes this.
  13. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    This is so good!

    I gave it a quick look when you announced it and tried the dependency viewer. It's pretty good!

    What I didn't notice was the dependency graph viewer (awesome), and the project browser integration (double awesome!)

    So this is a really great feature. I need to clean up a ton of folders with textures where we might be using one or two in each folder, so this should speed up my work with that greatly!


    Feedback:
    - The Project browser integration can't show numbers correctly for > 100 dependencies (so 108 dependencies looks like 08)
    - The Project browser integration doesn't activate before we've opened the dependency viewer and selected an asset. Is it possible to add an option for this to happen on startup? I can see you not doing it due to startup time, but I'd be happy to pay for the cost.
    - Dependency graph is cool, but it would be nice to have arrows on the lines showing the direction of the dependency
    - Dependency graph scrolling is a bit crazy. I think it tries to use the mouse position to decide how to scroll like the Animator window does, as where the mouse is has an effect on what happens, but it for sure doesn't work well in the dep graph.

    Again, great work, thanks for this tool!
     
  14. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hi there! Great tool so far! Some feedback from me too:

    1. For me personally, the horizontal dark lines are making everything more cluttered and harder to read.
    I like the clean background like in all the other Unity windows.
    upload_2021-9-22_11-28-43.png

    2. I would like to have the asset path split into 2, asset folder and asset name, so we can better view the project organization. I know this is not a project organizer, but maybe for the future an option to right-click > Move to folder option would be great.

    3. The graph viewer always shows an empty window:
    upload_2021-9-22_11-34-43.png
    upload_2021-9-22_11-34-13.png

    Thanks and have a great day!
     
    jonathans42 and Lars-Steenhoff like this.
  15. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Thanks for the great feedback.

    Clearly something we will fix.

    At first this was by design. After some discussion with other users will add a preference to select when you want the dependency provider to initialize. (i.e. at startup, first time you open the dependency viewer, never)

    Absolutely. We haven't disclosed much about the Dependency Graph Viewer because at the moment it is very just a toy. We need to explorer many advance UX workflow to make it very useful. Right now it lacks a lot of UX to browse dependencies.

    Clearly something we can explore and provide a preference for it.

    This is possible in >=2021.2 by adding new Search Table Columns.

    Start dragging assets from the project browser into that view and then expand dependencies by clicking the little +.

    If you want more fun, once you have a few dependency floating around. Right click in an empty space and select Layout > Spring
     
    Maeslezo and SugoiDev like this.
  16. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Oh beautiful, thanks for the answers! I missed that. A big text saying Drag assets here is really needed :D
     
  17. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    After installing the dependency viewer package, I started getting this warning at seemingly arbitrary times:

    upload_2021-9-23_13-8-30.png

    Is that coming from the package?
     
  18. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Oh, yes I need to deploy a new version of the search extension package since now
    vertices
    and
    faces 
    are built-in scene filters in the QS package.

    I will try to do this today or tomorrow.
     
  19. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Can you retry with

    "com.unity.search.extensions": "https://github.com/Unity-Technologies/com.unity.search.extensions.git#bb0105bd0f32157d9066cc47a76badda44aadd4e",
     
  20. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    Did it, seems to have fixed the problem (no warning after a few hours of work and also using the dep viewer)
     
    jonathans42 likes this.
  21. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Hi all,

    we are investigating new workflows to improve the value of the Dependency Viewer. The goal: help you act on information reported by the DepViewer. Some examples:

    - Help you track which properties are referring missing GUIDs and setup replacement for this missing assets
    - Safe Delete: when deleting an asset, warn about dependencies that might be affected.

    If you have any other ideas on such workflows to help clean up or fix your project feel free to post your suggestions here.

    Thanks,

    Seb
     
  22. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    The safe delete sounds pretty neat!

    Other things I'd love to have:
    1:
    I'd love some way of looking at the dependency graph of a build, instead of just files.

    So if after making a build, I could open the dependency graph viewer, and have a representation of the build as the root object, and then an edge from the build to all the things it pulls in directly, and then be able to expand down from there.

    That'd help a lot with understanding exactly which things are in, and how they get there. Doing that now requires remembering all the ways things go into builds, and then looking at them one by one.

    2:
    I'd love to be able to see an overview of shared dependencies between sets of scenes.

    This would involve selecting two or more scenes, and be able to see which things all of them are using. The goal would be to enable me to work more easily on grouping asset bundles, or otherwise controlling which assets are shared and which ones are unique.
     
    mariandev and Lars-Steenhoff like this.
  23. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    This also something I want to push further. We will sync with UX designer to see how we can provide the best experience for that.

    Right now it is possible to select multiple assets to see the combined dependencies but I agree it would be nice to have a way to quickly see which dependencies are shared. Would a color code or another column be better to represent that info? I will add this to our TODO.

    upload_2021-10-6_13-29-28.png

    Maybe we could render shared item in bold?

    Thanks for the feedback
     
    Lars-Steenhoff likes this.
  24. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    I think another column would be the best. Actually two additional columns - both uses (shared) and used by (shared) . They probably need to be toggleable so the UI isn't a mess unless we need it to be!

    An alternative would be to sort them and give them headers - so first showing the ones that are used by all, then a header for each other set showing only things used by those.
     
    mariandev and jonathans42 like this.
  25. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Thanks for your feedback Baste. Those are good suggestions. We are taking notes :)

     
    mariandev and Lars-Steenhoff like this.
  26. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    Hi, How can I find the usages of an "asmdef" asset?
    These always produce 0 results, even though I can see the usages.
     
  27. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Indeed, I think we need to do something custom for asmdef. I will add this to our todo list for 22.2.

    Thanks,
     
    bdovaz, mariandev, CDF and 1 other person like this.
  28. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi, would you only expect to see other asmdef references or you would expect to see all scripts compiled by the asmdef too?

    upload_2021-11-1_9-51-16.png
     
  29. MechaWolf99

    MechaWolf99

    Joined:
    Aug 22, 2017
    Posts:
    293
    I personally would expect to see asmdef references. However now that you mention it I feel like being able to see the scripts compiled by could be handy, idk what for, but it feels like it would be handy. Ideally for me I think there would be a toggle between only seeing asmdefs and seeing the scripts. But if I had to choose one, I would choose asmdefs and not scripts as I think that would be what you are actually interested in most of the time.
     
  30. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Here's what if gives with asmdef and scripts refs:

    upload_2021-11-1_13-58-39.png

    And the other way around for AliveAction.cs

    upload_2021-11-1_13-59-3.png

    See https://github.com/Unity-Technologies/com.unity.search.extensions/pull/12
     
    SugoiDev and mariandev like this.
  31. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    I would only expect to see other asmdefs that reference the queried asmdef, or anything that directly referenced the queried asmdef.
    Like if I had a custom scriptable object with an array of references to asmdef files. That should also be discoverable.
     
  32. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    CDF likes this.
  33. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    I'm trying to add the package to unity 2022.1.0a16 and I get this error:

    [Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/Unity-Technologies/com.unity.search.extensions.git]:
    Cannot checkout repository [https://github.com/Unity-Technologies/com.unity.search.extensions.git]:
    Error when executing git command. git-lfs filter-process: git-lfs: command not found
    fatal: the remote end hung up unexpectedly
    [NotFound].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorApplication.cs:359)
     
  34. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hmm a few users internally has reported that error too. I'll have to check with the Package Manager team why we get that git-lfs error. I'll get back to you.
     
  35. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    247
    Hello, toolset itself is great.

    at our situation we have 2 assets ( for example: shader and prefab) and have unclarified dependencies through 3-4 depth levels between them. What is the best way to find this asset-dependency-chain between them, with this tool? Clicking one by one all from both sides sounds unoptimal and time consuming. Is there anything like graph of dependencies vizualization? Like this one: https://github.com/Begounet/unity-dependency-graph-viewer/blob/master/Medias~/Screenshot02.jpg
     
  36. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi! Yes, there is a dependency graph vizualisation. If you click on "Window/Search/Dependency Graph Viewer", you should see a window pop up. In this window, you can drag and drop assets and inspect their dependencies and references.
    upload_2022-6-21_16-29-23.png
     
  37. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    247
    It's great, but one question is it 1-depth, or we can tweak it?
     
  38. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Once you drop an asset in the graph view, you can click on the numbered buttons to open the references/dependencies one level deep. If you wish to go deeper, you can do the same on the newly added references/dependencies to continue exploring the dependency hierarchy. In other words, this graph is interactive.
     
    Ruchir likes this.
  39. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    158
    When trying the dependency graph viewer on a big scene it hangs my Unity Editor... any way to see what may going on?

    Unity v2020.3.27
     
  40. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Have you built the dependencies first? We have a bug when the dependencies are not built dragging an item in the dependency graph viewer hangs Unity. Otherwise, you can always check with the profiler if you can see anything related with the Search Extensions or QuickSearch.
     
    esteban16108 likes this.
  41. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    158
    That was the issue, I forced a re-build and worked. Somehow I missed that step. Thanks
     
  42. Davon_Allen_AofL

    Davon_Allen_AofL

    Joined:
    Jul 17, 2019
    Posts:
    9
  43. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    It should work with packages as well. For example, I have a scene that uses two prefabs that I have in my project, and one of those prefabs (the Cylinder) uses a script coming from the Timeline package (SignalReceiver). The references are correctly shown:
    upload_2022-8-12_10-17-37.png
    All the assets show the description "In Project", but they should show where they are coming from (i.e. Project, Packages, built-in resources). We just didn't have the time to work on this.
     
  44. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    158
    @sebastiengrenier Is there a way that the index rebuild doesn't trigger every time something changes or I hit Refresh in Unity?
     
  45. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    There currently isn't. But it's a good idea to have a setting to enable/disable automatic indexing.
     
    esteban16108 likes this.
  46. Chaosed0

    Chaosed0

    Joined:
    Jun 19, 2013
    Posts:
    23
    Posting here simply to give a +1 to this tool. It's extremely useful for our asset-based data workflow. Incremental indexing is definitely something that would improve our usage of the tool.
     
  47. justink-sm

    justink-sm

    Unity Technologies

    Joined:
    Jan 14, 2022
    Posts:
    1
    This is a great tool.

    I've got an Android project I'm looking at and wonder how I might pull up the "Compression Format" for the audioClips I have found in the search.
    I can pull up properties for the audioClip such as Size, Path with this line:

    select{t:audioclip, @name, @Size, @Path as "Full Path" }

    but can't seem to locate a way to get the compression used (e.g. ASTC) for the audio file. Maybe AudioClip isn't the right type to search?

    Thoughts?
     
  48. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi! You can use this query that will select the compression format of an audio file:
    select{t:audioclip,  [USER=206145]@name[/USER], [USER=919983]@Size[/USER], [USER=437808]@Path[/USER], #compressionformat}

    You can use
    #
    for known properties that are not a builtin selector (i.e. name, path, etc.). One way to find such a property is to use the autocomplete feature of Search:
    upload_2022-9-6_13-44-3.png
    If you are not sure what the property is called, you can also check the keywords indexed by the Search index, and you will find a list of properties you can filter, and where they come from:
    upload_2022-9-6_13-46-17.png
     
    justink-sm likes this.
  49. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    I'd like to request some color coding in the search dependency viewers project editor:

    search_after.png search_before.png

    It can be difficult to see whether an asset is being referenced in a long list.
    By adding a colored background, it's much easier to see
     
    Thaina likes this.
  50. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    This is a good suggestion. I will suggest it to our designer.

    Keep in mind the Dependency Viewer has been put into hiatus for now since we are focusing more on general Unity stability but this is a project we will resume mid term.