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

Asset Hunter (Project cleaning tool)

Discussion in 'Assets and Asset Store' started by KristianHJ, Oct 15, 2014.

  1. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi all

    in 2011 i wrote a blog post on how to get a list of all unused assets in your Unity project. I released the source code for free, but quite a few people suggested to me that I could release it to the asset store. And now finally almost 4 years after I finally got around to make full rework of the tool, making it more robust, feature rich and user friendly.

    Asset Hunter is a tool that analyzes your buildlog/scenes and gives you an easily understandable overview over unused asset in your project folder.
    The results are grouped into folders and file types, making it easy to start cleaning up your project.
    Additionally it lists the uncompressed size of all the assets used in the build, enabling you to better downsize your buildsize.

    It also contains a reference graph which lets you see how assets reference each other. Additionally there is a duplicate tool that lets you find any duplicate assets in your project

    Is this a tool for me?
    Are you trying to go below a certain buildsize?
    Are all the old placeholder graphics and models cluttering up your project?
    Didn't you ever get around to delete the auto generated materials after model import?
    Do you have large amount of soundfiles in your project, but is only using a small number of them?
    Does it seem like too large a task to remove obsolete assets?
    Do you want to know which scenes reference a specific asset

    If any of the above is true, or you just have a messy project. This tool might help you out

    ****Link to the asset store****

     
    Last edited: Jan 4, 2022
  2. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I've heard that a couple of you get an OutOfMemory error when running the tool on really big projects.
    This is a well known Unity Issue due to the way Unity deals with garbage collection and the fact that Unity is 32bit. I'll try to see if I can make a workaround.
     
    Last edited: Nov 9, 2014
  3. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Ok, fixed. The tool is updated to handle much larger projects.
    Will commit for approval in the asset store today or tomorrow, so hopefully the updated version should be avaliable within the week
     
  4. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    573
    is a person forced to create a build soo that the tool works, or its a real time tool
     
  5. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    You need to create a build
     
  6. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    573
    Thanks for the reply. I notice another builder package that, after the build and the flush out of non used assets, that sometimes, it does flushes out used textures or meshes used in the scene.
    Does your package prevents that from happening

    Thank you again
     
  7. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Paulojsam

    It runs through the build log and finds all used assets, it then runs through all levels included in build and collects all used prefabs.
    Then it presents you with a list of all unused assets which you can then manually delete.
    With regards to the problem you mention other tools have with delete actually USED assets, I've never heard from anyone who had that problem with my tool. My tool wont delete an asset that is used in a scene.

    But obviously, do a backup and apply consideration before mass-deleting something :)

    Hope this answers you question
     
  8. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Just submitted version 1.2.0 today.
    • Asset Hunter can now find all scenes that reference a specific asset.
    • Included Collapse/Expand all buttons
    • Automatically deletes empty folders after asset deletion
    • Fixed delegate serialization issue
    Hope its approved and ready for download within a week
     
  9. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    [Reply to deleted comment]

    Yes, I guess I could add some settings for you guys to manually exclude certain folder, I'm doing it anyway with "Resources"+"Editor" and other folders, so its shouldn't be to big of an issue to give you some manual control as well. That will be included in next release (After the one currently in review)
     
    Last edited: Nov 28, 2014
    Cascho01 likes this.
  10. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Ups, just deleted my post, sorry.
    I just bought AssetHunter and I like it.
     
  11. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Glad to hear it. In the version you have, there is a serialization bug, but that will be fixed in 1.2.0 which was submitted Nov.19 so I think it should be approved soon
     
  12. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
  13. byerdelen

    byerdelen

    Joined:
    Mar 27, 2010
    Posts:
    68
    Hi,
    I had a huge project going on for some years and this goodie saved me 400mb with a click. Worked like a charm.
    But at the first look, I realised the scripts are not included to the process. I have many old and new scripts in folders that are used in many scenes, it would also take my hours to check if they are used in the scenes or not. Is there any way to make the Asset Hunter detect them also? It would increase my compilation time.
    Thanks
     
    KristianHJ likes this.
  14. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    It is definitely something that would be great to include, and on the top of my wishlist. The problem is that all script (Not editor scripts) are automatically included in build since you are allowed to add a script to a gameobject at runtime using string identification e.g. gameObject.AddComponent ("SphereCollider")

    I have yet to figure out a way to detect that in editmode, but if I figure out a work around I'll definitely add it.
    Currently I just wouldn't know how to circumvent Unity in that way
     
  15. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I have found a way to let you change the settings to exclude the folders and types you want to. Need to do some UI work to make it user friendly, but it will be in next update
     
    Last edited: Dec 1, 2014
  16. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    195
    This is on sale today.:) .

    I purchased this handy asset and left feedback.

    Hopefully dev does good with todays sale. Thanks for putting this tool on the asset store.
     
    KristianHJ likes this.
  17. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Newbee
    Thanks for the recommendations, you rock!
    So far the response have been really good and right now, "Asset Hunter" is the 3th most popular (Paid) asset on the store. Its cheap so I won't become rich off this, but it should cover the Christmas presents :)
     
    Last edited: Dec 1, 2014
  18. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi wheretheidivide

    It only indirectly helps reduce build size. It lists the assets you are using by file size, allowing you to make some informed decisions on which assets you need to remove/downsize.

    The description reads:
    "Additionally it lists the uncompressed size of all the assets used in the build, enabling you to better downsize your buildsize."

    I'm sorry you thought it had automatic buildsize reduction, perhaps I need rewrite the description if it can be misinterpreted. Hope the functionality as described in the above helps you achieve a smaller buildsize anyway.
     
  19. Atmey

    Atmey

    Joined:
    Nov 3, 2012
    Posts:
    88
    I'm not sure if this is the right place to ask this, according to this tool my skybox takes 90MB, I set it to "none", and it reduced the build size. But the question is, why does the skybox take 90MB? the png file is just above 2MB
     
  20. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I'm not sure since I'm basically just using the information Unity outputs during the build process.
    Afaik the skybox uses 6 textures, and you're only mentioning 1. Maybe the other 5 are really big?
     
  21. Atmey

    Atmey

    Joined:
    Nov 3, 2012
    Posts:
    88
    As in allsky package examples, I use cubemap, with skybox cubed shader.

    There is also some random assets included, they are neither in the scene nor in the Resources folder.
     
  22. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I doubt that this has any connection to my tool, but feel free to send me a mail on HeurekaGames at gmail with a package that contains the "troubled" assets
     
  23. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I've been made aware that icons and certificates are incorrectly listed as "Unused Assets".
    I'm working on making sure these are included in the build analysis, and it will be fixed in one of the next releases
     
  24. Atmey

    Atmey

    Joined:
    Nov 3, 2012
    Posts:
    88
    Looks like some faulty package from the asset store is acting up, it is automatically getting to the build even on an empty scene, removed the package and it is more than 100MB less, I guess I'll change the skybox as well, from 290MB to 89MB, thanks.
     
  25. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    NP, glad you figured it out.
     
  26. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Cascho01

    I just finished the Settings feature, and submitted it to the Asset Store. If you want to try it out beforehand, send me a PM. If not, it usually takes about a week for Unity to review, so It'll be available at that time.
     
  27. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    1.3.1 Is now live.

    -(NEW FEATURE) Added settings to allow for manually exclude folders and types
    -Asset Hunter is now path agnostic, meaning you can move the "Heureka" folder into any folder
    -Now recognizes build icons and Win8 certificate

    The Settings will allow to to e.g. not include 3rd party folders.

    NB: Splash screens are still not recognized since Unity's API does not allow me accessing these.
     
  28. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Happy New Year

    Here's the last three vouchers I have to give away:

    (EDIT)
    All taken
     
    Last edited: Jan 1, 2015
  29. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    394
    I just got and used this asset and it worked GREAT my 1 gig project is now 700 megs! Also very easy to use.

    My one request. I know Unity includes all the scripts because you can always add them on the fly. But it would be nice to at least have the option to scan all the included prefabs/gameobjects for which scripts they have and then show the "unused" ones. Even if you make me type "I KNOW THIS COULD BE BAD" into a text box before running the scan.

    Also, unused scenes would be great too. Lots of assets include demo scenes.

    Again thanks for making a really great asset. Totally worth the $10

    -Carmine
     
  30. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Carmine

    Good idea with the unused scenes, will add that.
    With regards to scripts, It's really the feature I have on the top of my personal wish list.
    There is just multiple issues that would make it more or less impossible to do a fool proof version.
    Will think about just adding a separate pane with a huge disclaimer that it should be used with care.
    I'm just ambivalent about adding a feature to a tool that I sell for money, that I can't guarantee will work properly.

    Happy you like the tool :)
     
  31. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    1.3.3 is now live

    -Unity 5 ready
     
    frikic likes this.
  32. frikic

    frikic

    Joined:
    Dec 22, 2011
    Posts:
    44
    Is it possible to set it in order use it with 2dToolkit? All images in my project came up as unused, even they are used by 2d toolkit sprite atlas. If not is it possible to this be included in some of the future updates?
    Great tool, but since my projects are done with 2dToolkit, i cant use it in full potential.

    Here is a snapshot of how it looks like when i run asset hunter, note that i have 3 2dtoolkit types recognized at the end, even i didnt manually include them.

    AssetHunter.png
     
    Last edited: Sep 28, 2015
  33. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Frikic

    The way Asset Hunter works is (mainly) by analyzing the build log and comparing that to the assets in your project. I have no way of automatically analyze other 3rd party tools and figure out if the workflow relies of some asset that shouldnt be included in the build. i.e. the Texture Atlas done by 2Dtoolkit (Or any other atlas tool)

    What I have included in the tool though is a way for you to manually exclude certain folders or file types.

    If you have your tk2d source files in a specific folder you can choose to exclude that folder by doing the following:

    1: Press the "Edit Settings" button in the "Asset Hunter" window
    2: Select the folder you wish to exclude OR
    3: Select a file of a type you wish to exclude
    4: Press the "Exclude" button

    That will make sure that that folder (Or file type) will not be used by "Asset Hunter" anymore.

    I'm aware that means you have to manually keep track of which source files are used by tk2d. But I have no means of doing a solution that takes the functionality of all tools under consideration.

    I hope the Asset Hunter settings can help you somewhat
     
  34. frikic

    frikic

    Joined:
    Dec 22, 2011
    Posts:
    44
    "I have no way of automatically analyze other 3rd party tools and figure out if the workflow relies of some asset that shouldnt be included in the build. i.e. the Texture Atlas done by 2Dtoolkit (Or any other atlas tool)"

    Thanks for the answer, do you think that it make sense to request new feature to 2dToolkit makers, in order to they include this info into build log? And if this is possible, what would be the way to request this?
     
  35. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I doubt 2dtk will be able to hook into the buildprocess, but I have thought of a way that might enable Asset Hunter to track construction-assets such as the ones used in 2dtk. It will not be automatic, and will require some manual setup, but it should be possible. I've written that on my todo list for Asset Hunter
     
    frikic likes this.
  36. Wompipomp

    Wompipomp

    Joined:
    Aug 31, 2014
    Posts:
    24
    Hi,

    great asset! Already cleaned up my project folder. :)
    Just a (maybe dump) question. What about cleaning up unused scripts e.g. I have many scripts from the standard assets in my project folder so I'd like to clean them up before I will check them into github.
    I saw that you already have a list with all the used scripts if I click on build report. Is there any options to see the scripts?

    Thank you very much,
    best regards,
    Mark
     
  37. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Mark

    That's not dumb at all, and its actually at the very top of the list of things I wan't to do with Asset Hunter.
    Just quite hard to do so :) Since Unity by default includes ALL scripts in a build, I can't get that information from the build log.
    I have an idea of how to achieve it, but still have no real breakthrough.

    Cheers,
    Kristian
     
  38. Wompipomp

    Wompipomp

    Joined:
    Aug 31, 2014
    Posts:
    24
    Thank you very much for your reply.

    Looking forward to the feature :)
     
  39. Aniko_V

    Aniko_V

    Joined:
    Jun 19, 2014
    Posts:
    2
    Hello. What mean a red button "Load Build Log (Required)" ?
     

    Attached Files:

  40. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Hello,

    I'm using Asset Hunter, it cleaned my project, but now I cant get project to compile.

    Here is the error I'm getting, I'm using Unity 5.1, any ideas?


    Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

    at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

    at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0

    at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0

    at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
     
  41. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Aniko

    First of all, sorry I haven't replied before, don't know how I missed your post. But for some reason I did.
    The button and text just means that my tool requires you to create a build before it can function. So just create a build, and you will be able to run the cleaner
     
  42. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Seems like the issue is a (relatively) well known Unity 5 issue. Doesn't seem related to my tool.

    Here's a few threads to get you started:
    http://forum.unity3d.com/threads/id...-module-cannot-be-loaded.230389/#post-2074554
    http://answers.unity3d.com/questions/636739/reflectiontypeloadexception.html
    http://stackoverflow.com/questions/...ection-reflectiontypeloadexception-in-unity3d
    http://forum.unity3d.com/threads/re...lasses-in-the-module-cannot-be-loaded.292774/
    http://forum.unity3d.com/threads/ca...eflection-reflectiontypeloadexception.132592/

    Again, I can't see how asset hunter would be able to be the cause of this, but don't hessitate to contact me again if you find any evidence of the contrary
     
  43. kaufcom

    kaufcom

    Joined:
    Sep 23, 2015
    Posts:
    2
    Hey Kristian
    We just are trying to use Asset Hunter... but somehow with Unity 5.2 patch 1 it doesn't work anymore. Any ideas?
    Cheers
    Roberto
     
  44. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Roberto

    Ill get 5.2.1 and try to replicate.
    Will post here when I know more
     
  45. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Ok, quickfix ready.
    Line 103 in AssetHunterHelper.cs reads:
    while (!SR.EndOfStream && !(line = SR.ReadLine()).Contains("Used Assets,")) ;

    You need to remove the Comma near the end so it will read:
    while (!SR.EndOfStream && !(line = SR.ReadLine()).Contains("Used Assets")) ;

    Somebody at unity has OCD about comma-rules which means they made a minor change in the build-log output.
    I'll commit a fix today, but until its passed review you can fix the issue by doing the above
     
  46. kaufcom

    kaufcom

    Joined:
    Sep 23, 2015
    Posts:
    2
    Hey Kristian

    Thx for your help!
    You will receive my 5 stars :)

    Have a great day
    Roberto
     
  47. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Yay :)
     
  48. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Hello,

    how does this work with Unity 5.2?

    We have several scenes. Can we check all the assets for all the scenes? For example we might have a chair that is only used in Scene 3... so if we use it on Scene 1 & 2 it will tell us to "Delete the chair" then the Scene 3 will get broken.

    Thanks
     
  49. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Yes, it will work in Unity 5.2
    The tool check your build log, so if you have "Scene 3" added to your build, it won't show up as unused.
    If you make a build with only "Scene 1" and "Scene 2" it WILL show up as unused.

    The tool will also show you a list of used assets and which scenes each asset is used in
     
  50. bteitler

    bteitler

    Joined:
    May 11, 2014
    Posts:
    52
    One of the reviews for this package said that it does not look inside prefabs:
    Did you ever figure out what the issue was with this developer? I have a project with many prefabs instantiated at run-time (as I'm sure most large games do). This comment didn't seem to mesh with the idea that that the script is parsing build dependencies, since obviously prefab dependency are required for build.