Asset Usage Detector - Find references to an asset/object [Open Source]

I haven’t used Behavior Designer myself, so I can’t really tell how to accomplish this, sorry :confused:

This is awesome, Thank you for writing this tool. Saves a lot of time

1 Like

Thank you :slight_smile:

1 Like

Thank you very much, this saved me a lot of time!

1 Like

This script has saved me so much hassle when trying to find dependencies for my asset bundles.
Thanks very much!

1 Like

Thank you very much! This is awesome!

1 Like

Updated the plugin on GitHub and Asset Store.

NOTE: If your project uses an older version of AssetUsageDetector, delete the older version before updating the plugin.

A part of the search algorithm has changed to reduce the memory usage and allow for faster searches with caching support (previously, EditorUtility.CollectDependencies was used; now AssetDatabase.GetDependencies is used). Although unlikely, this might result in some references being skipped in the search. If you find any issues, please let me know.

Here’s a summary of the changelog:

- Caching asset dependencies for faster calculations

  • Dependencies are checked via their paths, so loading the asset is not necessary and much less memory will be used
    - Each searched asset now has its own toggleable sub-assets
    - Adding folders to searched assets is now possible
    - Searching references in a subset of the Project view (Assets folder) is now possible
  • Simplified the output nodes:
    — multiple links from same node to same node are combined into a single node
    — root nodes that are part of another node’s siblings are omitted
  • Added Timeline, Sprite Atlas and Tilemap support
    - Added better support for the new prefab system
  • Bugfix for structs’ property getters throwing exception
  • Separated AssetUsageDetector.cs into smaller classes
  • Made AssetUsageDetector a standalone editor script, so you can now use it in your own editor scripts to calculate some objects’ references

Hi,

I’m trying to use this extension, but I get a stack overflow on the recursive “AssetHasAnyReferenceTo” @ line 1015

Any ideas on that?

Thanks!!

Same problem for me. Unity 2018.3.8

Thanks for reporting this issue. I was able to reproduce and resolve it (and one other issue that I’ve spotted). I will update the plugin on GitHub today.

P.S. The update is now live @BadViking @Vicomte

Why did it have to be me…I don’t see it in the windows menu. Are you meaning the windows menu next to the help menu because it’s not listed. I am using 2018.3.8f1.

It is located there. If there are any error messages in the console, you must resolve those errors first.

4801532--459137--editor.png

1 Like

Hello, after the last update was working but today it stopped to give results (always no results found). There is a way to delete the cached data?

Yes, it is located at PROJECT_PATH/Library/AssetUsageDetector.cache. It might be related to this bug: Asset not found after rename (cache issue?) · Issue #11 · yasirkula/UnityAssetUsageDetector · GitHub

Hey, great work so far on the tool… can’t wait to use it.

I’ve got it on Unity version 2019.2.2 and seem to be getting a crash bug no matter what asset I’m trying to search in the project view. Is there a fix available?

Thanks again for the hard work put into this so far!

InvalidCastException: Specified cast is not valid.
Model.Unit.Equals (System.Object obj) (at <8efbdbeaeed1474b83928e86de15dabc>:0)
System.Collections.Generic.ObjectEqualityComparer1[T].LastIndexOf (T[ ] array, T value, System.Int32 startIndex, System.Int32 count) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) System.Array.LastIndexOfImpl[T] (T[ ] array, T value, System.Int32 startIndex, System.Int32 count) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) System.Array.LastIndexOf[T] (T[ ] array, T value, System.Int32 startIndex, System.Int32 count) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) System.Array.LastIndexOf[T] (T[ ] array, T value, System.Int32 startIndex) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) System.Collections.Generic.Stack1[T].Contains (T item) (at <376e8c39bbab4f1193a569c8dbe4305c>:0)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:607)

Thanks for reporting this. I am unable to tell why this exception isn’t caught by this catch block. Regardless, can you try applying the following script modifications to your project?

4913903–475820–AssetUsageDetector.cs (43.9 KB)
4913903–475823–Utilities.cs (14.7 KB)

Super! Seems to be working great. Its already saving a ton of time… some friends wonder why this kind of functionality isn’t standard.

Great work!

1 Like

Thanks, but removing the cache did not solve the issue.
Actually I have reverted to the old version without cache. (slower but works …)

Let me know if you need some tests with the new version. In production we keep the old version meanwhile.

Best Regards

I’m sorry to hear that. Can you tell what kind of a reference the current version of the plugin fails to find?

Hello the asset was a Sprite linked directly in the Main scene and the issue is for sure related with the cache (old version works).

The project is a production project with several branches and I switch branch quite often (may be related?). Strange thing: if I delete the cache nothing change.

Let me know if you need some tests, in the meantime I am using the old one.