Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Find References To Asset

Discussion in 'Assets and Asset Store' started by OmniShader, Dec 2, 2023.

  1. OmniShader

    OmniShader

    Joined:
    Feb 12, 2022
    Posts:
    43


    Find References To Asset on the Unity Asset Store

    Discord Support | Email

    Find References To Asset
    is a lite editor tool that performs a reverse search, finding all references to a specified asset. It's simple to use, supports finding multiple assets simultaneously, and super fast with near-instant results even on massive projects!

    This tool may be your single most-often used tool once you have it, particularly for developers and artists. It's extraordinarily useful for debugging, tracking how assets are used, or if they're unused even.

    Features
    • Ultra-fast, near-instant results
    • Auto-search selected asset on open
    • Support for multiple assets search
    • Option to exclude assets not in the build
    • Click search results to quickly ping the asset
    • Search for previous results to recursively look up ancestor references
    Note: This tool relies on ripgrep for its ultra speed (up to 10x faster than grep), a freely downloadable command-line tool available on Macs, Windows, and Linux. ripgrep is so fast, there is no need for indexing or caching files like alternative search solutions.

    That's it, I hope you love it!
    It's unbelievable that a tool as useful and convenient as this is not included in Unity. Once you have this, it is absolutely indispensable.

    *Note that this reverse asset search is NOT replicable with any built-in Unity methods or search functionality, as this kind of search is very difficult to do efficiently without tools like ripgrep.
     
    Last edited: Feb 13, 2024
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,065
    That's a pretty bold statement when there's AssetDatabase.GetDependencies(..), which I'd trust to give me correct results. I'm skeptical when I read "grep" which implies regex parsing of YAML files. Speed is not the big value proposition, it's correctness.
     
  3. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,279
    I think it's bad form to dunk on someone's asset, even while it's labeled as a Pending Release. Maybe turn it into a question instead of a dismissive criticism based on nothing but their announcement.
     
  4. OmniShader

    OmniShader

    Joined:
    Feb 12, 2022
    Posts:
    43
    Thank you for the interest already! It's not even released :)
     
  5. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,065
    You're right, thanks for calling it out. I'll give it the benefit of the doubt.

    What I don't see - in the description - is how this is any improvement over the script API and the build analytics you already get from Unity. Bold marketing speech just triggers me in such a case.

    Also, I have this "show dependencies of an asset" feature in a free AssetInspector package, plus everything else one can learn about an asset using the built-in API. I don't go around calling this "unbelievable". It just isn't.
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,571
    I believe that what the tool provides is the inverse of "GetDependencies". For example, it does not display "Material A depends on Texture B," but rather "Texture B is referenced by Material A".

    Such functionality is very useful and needed, I need such thing almost daily. I remember asking the Unity Search team if their tool supports it, but I cannot recall their response.
     
  7. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,065
    I see! The clue is in "reverse search". Okay, granted, that's useful. ;)
     
    Peter77 likes this.
  8. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,065
    So I woke up this morning and feel compelled to apologize for my behaviour! I'm sorry!

    I had already been triggered earlier that day due to Intel's marketing bullcrap about their "AI Assist" overclocking software - which has nothing to do with AI and has been a built-in feature of computers for a decade: automatic overclocking. And then some other assets that were doing the Steve Jobs' marketing approach ... it's AMAZING and .. (imagine more superlative yet utterly meaningless adjectives here) .. :rolleyes:

    Just to explain where I was coming from.

    Still I'm wondering: couldn't this be done using GetDependencies? It would require an initial up-front scan of all assets to get their dependencies, but once you have that and store that info, subsequent scans will be faster AND it's guaranteed to be 100% correct and wouldn't have to rely on a cmd tool that may or may not have been tested whether it produces correct results on all three editor platforms.

    A tip on messaging: "references to asset" is somehow, in my mind at least, vague.
    If it were "asset is used by" it would better convey the idea that you're inspecting an asset and get to see where it's being used. It's sort of the subtitle of the image but it has this opposing views conflict in it "references to" and "used by", the latter explaining the former. One should suffice. If "references to asset" needs an explanation, it's better to use the explanation.
     
    Last edited: Dec 3, 2023
  9. OmniShader

    OmniShader

    Joined:
    Feb 12, 2022
    Posts:
    43
    Yes this is a "reverse-search" tool, and no it cannot be done using AssetDatabase.GetDependencies() unless you were to call that on every file and then aggregate the results leading to a certain asset, and while you could cache this upfront the results would be massive and get out of date fast. My guess Unity does not offer this is because it is very difficult to implement efficiently. This tool is only made possible through the use of ripgrep, a version of grep that is up to 10x faster in file searches. The tool's results are 100% accurate, I have been using it myself almost daily for the past year. Anyways, hope this is accepted into the store soon so you can try it out :), and thanks again for noticing!
     
    Last edited: Dec 4, 2023
  10. OmniShader

    OmniShader

    Joined:
    Feb 12, 2022
    Posts:
    43