Search Unity

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
    You should definitely update. Since 2.1.0 there has been following changes:
    Quite a lot of them if about deletion and multi selection
    • Fix for BuildReport.Files being deprecated in 2022
    • Fixed issue with incorrect asset size
    • Fixed issue with OnProcessScene being called when entering playmode
    • Fixed issue with Upgrader being Editor Only
    • Moved to UPM Package format
    • Added null checks in dependency graph
    • Exclude shaderinclude files by default because of Unity dependency bug (2021.2 and newer)
    • Removed obsolete code
    • Fixed bug where selecting folders would not delete/Backup the corrent assets
    • Fixed bug where selecting multiple asset when clicking backup would cause AHP to ask you to backup multiple times
    • Improvements to Mass Delete
    • Improvements to Empty Folder Deletion
    • Fixed faulty documentation link
    • Fixed issue with progress bar not actually moving when analyzing project
    • Fixed warnings when trying to delete empty folders
    • Reduced logfile size
    • Tweaked logfile datamodel
    • Improved speed by not requiring assetsize calculations by efault
    • Updated documentation file
    • Fixed bug with header
    • Added MenuItems to Tools in menu
    • Tweaked button layout
    • Fixed issue with Window Store Apps (WSA) Ressources
    • Fixed issues with icon colors in light editor theme
    • Added settings to control automatic sync after projectchanges
    • Improved multiselection in treeview to improve delete functionality
    Note however that in 2.2.8 I moved AHP to the UPM format as mentioned in this post.
    I was worried at the time it might introduce some quirks during upgrade from older versions, but havent heard anyone talk about that, so It should be unproblematic.
     
    Romaleks360 likes this.
  2. majidarif

    majidarif

    Joined:
    Sep 11, 2015
    Posts:
    26
    Hello, I think the build is actually completed already hence the "FinishPhase" but it gets stuck there. And yes, I've confirmed removing AHP brings back the original build time.
     
  3. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hmm, never heard about this being an issue before, so its hard for me to reproduce - I will keep looking though.
    I dont assume its possible for you to share your repo with me?
     
  4. danam

    danam

    Joined:
    Mar 30, 2015
    Posts:
    11
    Hi @KristianHJ , I recently purchased your Unity Utility Asset hunter pro and I have a few questions:

    1) I would like to export the list of unused assets for use in a spreadsheet to present to my dev team. Does Asset Hunter Pro have this capability?

    2) I am running this utility on a large scale Unity project, where I may designate this utility in my git ignore list. Is this going to cause any issues when I push my changes ?
    How do I add this utilitty to my .gitignore file so it is not included in my repo?

    3) Is there a way to ignore assets that are not used, but have dependencies?


    Thanks for your help, I love the product so far!
     
    Last edited: Feb 8, 2023
  5. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi danam, thanks for your message. Answered your mail, but adding info here too so other people can use it :)

    1: You can export a json file like this:
    exportlist.png
    It exports whatever is selected in the tabs “Unused/Used/All”. E.g. if “Used” is selected it exports a list of used assets.


    2: Git ignoring AHP might be a bit tricky since its a "Package" and not an "Asset" - which means it will never be part of the repo, but downloaded to each users computer through the package manager. I dont know of a way to control this individually but the question was asked here https://forum.unity.com/threads/local-override-manifest-json.1096891/


    3: I don’t have an automated way of ignore ‘unused with dependencies’ but there are several ways of ignoring in AHP. By folder, by name, by extension etc.

    You can learn more here https://kristianhj.gitbook.io/asset-hunter-pro/additional-windows/ignore
     
  6. danam

    danam

    Joined:
    Mar 30, 2015
    Posts:
    11
    Thank you for your response. Just incase others want to be able to create a list of used/unused assets: Using "Export list" creates a file of type .ahfiledump, but it's a basic JSON format. I used https://jsonformatter.org/ to make the json readable. To import into GoogleSheets you need a JSON API host, I used https://www.pastebin.com and added a free Google Sheets add-on KPIBees to import into Sheets, and I'm ready to show the team!
     
    KristianHJ likes this.
  7. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Again danam.
    It rubbed me the wrong way that you had to jump through those hoops in order to get something presentable in gsheets, so I've added the option to export in both csv and json format.
    upload_2023-2-10_12-36-40.png

    Resulting in:
    upload_2023-2-10_12-38-45.png

    I also modified the default file name a bit so it becomes:
    "AHP_*PROJECTNAME*_*BUILDDATE*_*BUILDTARGET*_*LISTTYPE*
    Hopefully that should make it easier to manage differences between different builds.
    v2.2.16 is avaliable now in the asset store, and contains this new feature
     
    Last edited: Feb 10, 2023
    danam likes this.
  8. danam

    danam

    Joined:
    Mar 30, 2015
    Posts:
    11
    this is awesome! Thank you. One other thing that would be helpful is to include the filename as one of the list attributes.I had to do some parsing to extract filenames from the paths
     
  9. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Yeah, was thinking about adding that, but since we can have multiple scene files named the same, but saved at different locations i would have to add the full path. Having to store multiple paths for maybe many thousands of assets could spiral the filesize out of control.

    For now I will stay with just the scene GUID although I understand the reasoning for wanting the filenames. Just havent found the right way of doing it yet.

    If this is something you really need, could you please elaborate on your usecase (Either here or through mail)
     
  10. danam

    danam

    Joined:
    Mar 30, 2015
    Posts:
    11
    The use case is mainly for designers (or nonengineers) to have a quick reference to particular assets. No biggie. ;)
     
  11. DrNim

    DrNim

    Joined:
    May 31, 2022
    Posts:
    1
    Hey Kristian, I love this tool and just wanted to make one suggestion. I am using a WebGL template and I noticed the "index.html" file of that template is turning up as an unused file. I may be missing something, but I suspect you would always want to exclude the "WebGL Templates" folder in the main Assets folder.
     
  12. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    What's the deal with this "Achievement Unlocked Obsessive Compulsive Cleaner"? After I delete a few things it won't let me do anything until I create a new build. This is AMAZINGLY ANNOYING!
     
  13. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Sorry, completely missed this message. Never used WebGL templates, but that definately sounds like a good idea. I will get than in a future update. Untill then, you can manually exclude the folder in settings. https://kristianhj.gitbook.io/asset-hunter-pro/additional-windows/ignore
     
  14. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi jnbbender. Sorry to hear you are experiencing problems. The "Achievement unlocked" is just meant a fun little easter egg when your project is completely clean of unused assets. It was definitely not indented to obstruct workflow in any way.
    So I just need to understand:
    1: You create a build
    2: Open AHP
    3: Deletes a few unused assets (Not all of them?)
    4: You see the "Achievement Unlocked"
    5: You create a new build
    6: Now you see some unused assets again?

    Am I understanding you correctly?
     
  15. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Yep. That's when I uninstalled then reinstalled Asset Hunter.
    If it helps I am using 2022.2.11. I was having issues with Kronnect Shader Control. He fixed it because of some of the caching that 2022 does, if that helps.
     
  16. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    The "achievement" only shows when the project is clean, and therefore rebuilding should not make it disappear. I will investigate and see if I can repro. Thanks for the bug report.

    EDIT: I have been unable to repro. The "Achievement" only appears for me when the project is clean. Maybe the problem is that I dont communicate well enough that that is in fact what it means. I will try to make a clearer in the UI.
     
    Last edited: Apr 12, 2023
  17. osgseb

    osgseb

    Joined:
    Jan 17, 2022
    Posts:
    26
    Hello,

    I have just installed Asset Hunter Pro 2.2.17 on a Unity 2022.2.11 project running on a Mac M1 and when I clicked on "create a new build" nothing happens, not even an error or a warning on the console. Any idea what's going on ?

    Thanks
     
  18. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    You want to see this in the log after creating a new build:
    upload_2023-4-12_15-11-5.png

    The process is:
    1: Open a project
    2: Open AHP
    3: Create a build (File->BuildSettings->Build)
    4: AHP will ask you if you want to load the infofile (which was just generated)
    5: Press yes
    6: The build report will be presented to you

    You can also read the documentation here: https://kristianhj.gitbook.io/asset-hunter-pro/guides/getting-started
    Hope this helps :)

    NB: From now on you can just have AHP load that infofile at any point if you want to see the report
     
  19. BrianDuffyGames

    BrianDuffyGames

    Joined:
    Sep 16, 2018
    Posts:
    9
    Just started working with this asset, and for some reason every time I try to 'find duplicates' the progress bar gets about half way and then the project crashes completely. Any advice?
     
  20. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Duffy, never heard about this issue before. Is it a very, very big project? Also is there anything in the editor log files which might give some indication?

    EDIT: Its a long shot, but I found some "leftover debug code" which should have been deleted. If you have thousands of assets in any folder called "navmesh" that might have triggered an out of memory issue. I just pushed an update to the asset store. Again, it's a long shot, but maybe that was the cause of the problem you are experiencing.
     
    Last edited: May 6, 2023
  21. AcIdSaMa

    AcIdSaMa

    Joined:
    Dec 5, 2012
    Posts:
    19
    Well looks like I also have the issue as well of builds not wanting to complete first time it got stuck at the "FinshPhase", now it gets stuck in copying resources.resource.

    If I uncheck auto generate log in the settings my builds finish.

    I'm using 2022.1.24 if that has anything to do with it..
     
  22. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi AcidSaMa, sorry to hear you are experiencing problems.
    There is many forum threads about Unity getting stuck in build process, so I need some more info to figure out what is happening.

    Would it be possible for you to follow the steps in this thread and send me the editor log. That might help me figure out what your problem is.
     
  23. cadris_unide

    cadris_unide

    Joined:
    Jun 11, 2022
    Posts:
    3
    Hi, I am new to asset hunter pro. I do not know much about it.
    I had completed my project then I think to decrease the size of project . So I choose Asset hunter pro to do so.


    But main problem is that my some essential models and textures got deleted. So I want to recover them. so how can I do this?? Please help me! I need this :( and I do not click on backup button while deleting...


    Thanks
     
    Last edited: May 31, 2023
  24. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi cadris_unide

    Asset Hunter PRO shows which assets can be deleted based on info from latest build. Maybe you did not have the correct scenes set up in build settings?

    Asset Hunter has a "Backup and delete" button. If you chose that option, simply doubleclick the backup file. If you did not choose that option, then you need to use your version control to get the files back. If you do not have version control control set up, then I'm afraid I cant help you.
     
  25. cadris_unide

    cadris_unide

    Joined:
    Jun 11, 2022
    Posts:
    3

    Thanks for replying.

    But not able to recover them because I do not choose backup while deleting and I do not have any version control.
     
    Last edited: May 31, 2023
  26. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I'm very sorry to hear that, but I fear that I cant help you then. Maybe look in trash and see if it is there.
     
  27. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    Is there a way to see what gameobject in a scene is using a script?
     
  28. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    it can support assets from Resources.Load or LoadAll ?
     
  29. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Nope, it does not show you which assets are loaded through Resources.Load. Everything in that folder is added to build by definition. Resources.Load takes a string, so there is no way for AHP to know what you are loading at runtime.
     
  30. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    It only finds references on prefabs. If your gameobject in scene is a prefab, then yes, but if its not, then no.
     
  31. allworknoplay

    allworknoplay

    Joined:
    Mar 5, 2015
    Posts:
    21
    Hi --- just bought AH pro, and when the window opens (from tools menu or hotkey), it's not doing anything and I think is missing the option for me to create a build. The "Load existing / create new build" text does highlight (black) on mouseover, but doesn't respond to clicks.

    Unity 2023.1.3f1, mac M1.

    The other buttons respond, but they're obviously not the main tool. I've restarted editor and computer and restored cleanly from my last git commit to try again, but same behaviour. Didn't see anything in the settings that looked relevant. Not sure where else to look.

    The following warnings showed up in the console on start:
    Code (CSharp):
    1.  
    2. Packages/com.heurekagames.utils/Editor/Heureka_AddDefineSymbols.cs(17,36): warning CS0618: 'PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup)' is obsolete: 'Use GetScriptingDefineSymbols(NamedBuildTarget buildTarget) instead'
    3.  
    4. Packages/com.heurekagames.utils/Editor/Heureka_AddDefineSymbols.cs(25,17): warning CS0618: 'PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup, string)' is obsolete: 'Use SetScriptingDefineSymbols(NamedBuildTarget buildTarget, string defines) instead'
    5.  
    6. Packages/com.heurekagames.assethunterpro/Editor/Scripts/AH_PreProcessor.cs(17,32): warning CS0618: 'PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup)' is obsolete: 'Use GetScriptingDefineSymbols(NamedBuildTarget buildTarget) instead'
    7.  
    8. Packages/com.heurekagames.assethunterpro/Editor/Scripts/AH_PreProcessor.cs(34,13): warning CS0618: 'PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup, string)' is obsolete: 'Use SetScriptingDefineSymbols(NamedBuildTarget buildTarget, string defines) instead'
    9.  
    10. Packages/com.heurekagames.assethunterpro/Editor/Scripts/AH_Utils.cs(188,44): warning CS0618: 'PlayerSettings.GetIconsForTargetGroup(BuildTargetGroup)' is obsolete: 'Use GetIcons(NamedBuildTarget, IconKind) instead'
    11.  
    12. Packages/com.heurekagames.assethunterpro/Editor/Scripts/AH_Utils.cs(191,51): warning CS0618: 'PlayerSettings.GetIconsForTargetGroup(BuildTargetGroup)' is obsolete: 'Use GetIcons(NamedBuildTarget, IconKind) instead'
    13.  
    14.  

    upload_2023-11-4_13-57-28.png
     
  32. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hey there. Regarding the warnings, there must be some new API changes to the Unity version you are using, I will fix that in next update. It shouldnt affect the tool however.

    In order work with AHP you need to install it and then create a build. Creating a build after having installed AHP, will generate a new "buildinfo" file which can then be loaded (Will happen automatically, but you can choose to load older buildlogs if you need to).

    There is a step-by-step here https://kristianhj.gitbook.io/asset-hunter-pro/guides/getting-started
     
  33. allworknoplay

    allworknoplay

    Joined:
    Mar 5, 2015
    Posts:
    21
    Hi, thanks for responding. Yep, I've read all the doc over and over; there's just no way that I can see for me to create a build. It's it possible I'm missing something -- the doc says everywhere to create a build, but doesn't say specifically what to click or what to do to actually do that. Like I said, In my case, the text "Load existing / create new build" changes color on mouse over, but seems unresponsive to clicks. I'd mostly assumed (but also tried literally everything else I could find anywhere) that the text or the elements around it were how to start a build, as the other UI elements were all for different things (but I tried them all too).

    I did see in your doc that you said the build file/directory should be created -- I checked repeatedly after trying things and none was created. I also tried simply waiting a long time in case there wasn't clear UI feedback but something was running in the background -- no luck.

    Just so we can make sure I'm not just missing something, what exactly does one do or click to create an initial build, and what's the expected UI result of clicking/starting whatever? I there anything else I could try or tell you that would help?
     
  34. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    AHP does not have a way for you to create the build, it simply hooks into the default unity build pipeline. That means, you need to create a build in the way you normally would through build settings.

    So the steps are:
    1. Install AHP
    2. Open AHP
    3. Open unity build settings
    4. Create a build from there (Remember to add the scenes the final build should contain)
    5. When done, you will be promted if you want to load the newly created "buildinfo" file. The folder you mentioned in the above will also have been created at this time.
    If that doesnt work, there must be a compile error somewhere in your project - cant think of any other reason.
     
  35. allworknoplay

    allworknoplay

    Joined:
    Mar 5, 2015
    Posts:
    21
    I see -- so sorry, I really thought it was a build of your asset index or something, didn't realize it was a game build. My bad, and thanks for your help!
     
  36. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Sorry for the late response, been out of town for the week. No problem, you are not the first who thought so. AHP used to allow creating a build directly, but there is so many ways that people can confgure their buildpipelines (Which the tool can not know about) so I removed it to ensure people used the default one.
     
  37. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    and how about assets in resources folder, that need to load by Resources.Load ? it still count as used assets?
     
  38. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Yes, everything you place in resources folder is added to the unity build regardless if you load them or not. Its mainly a place for prototyping in my opinion and for production you should consider using something other than resources folder.
    AHP simply analyzes the build, and everything in resources is added to build by default - and is therefore marked as "used"
     
    Rachan likes this.
  39. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    Ok, I really want to know,
    how to get used/unused assets in Resources folder?
    I see ignore asset option too.
     
  40. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    Actually I used to finding all unused Asset in Resources folder too,
    by reading all line of scripts in the project
    just to find "Resources.Load" and then get the path after
    to find actual asset of that path,
    so I can found this asset is still using or not in that Resources folder,
    But this way take so much time to read all line of scripts,
    if your project is very big

    But this should be the importance feature that you have to make!
    I thought you already did it, I have so much work in my project
    I can't split body to make this myself too.
     
  41. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Resources is a poorly implemented solution for asset loading, and Unity even acknowledges this and recommends not using it https://docs.unity3d.com/Manual/BestPracticeUnderstandingPerformanceInUnity6.html.

    There is no way I can made a dependable way of knowing which assets in resources are used and which are not. Its takes a string and that string can come from anywhere - a database, an online service, text concatenation and so on.

    I could have a method (similar to the one you proposed) that would take the most basic uses of resource.load, but that would result in a TON of false negatives for anyone with more advanced resource loading setups - which would make users believe they could delete an asset which was in fact used.

    So I'm sorry to say, that resources folder handling will never be a part of AHP, as there is no way for me to make it bulletproof.

    Thanks for contacting me though, I will update the description in the store to make this more explicitly stated, to make sure people dont buy under that belief.
     
  42. Styxu

    Styxu

    Joined:
    Oct 23, 2023
    Posts:
    1
    Hello,

    I've added the Asset Hunter into my project to do the clean up bo the problem is that the build is termineted right at the end.
    I am using Unity 202.3.11f1 and the lates version of the Asset Hunter.

    The error message I get is this:

    AH: Initiated new buildreport - 29.11.2023 19:45:35
    UnityEngine.Debug:Log (object)
    HeurekaGames.AssetHunterPRO.AH_BuildProcessor:initBuildReport (UnityEditor.BuildTarget,string) (at Packages/com.heurekagames.assethunterpro/Editor/Scripts/AH_BuildProcessor.cs:66)
    HeurekaGames.AssetHunterPRO.AH_BuildProcessor:OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport) (at Packages/com.heurekagames.assethunterpro/Editor/Scripts/AH_BuildProcessor.cs:32)
    UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions)
    BuildTool:Build (UnityEditor.BuildTarget,bool,string) (at Assets/_GameAssets/Scripts/Editor/BuildTool/BuildTool.cs:147)
    BuildTool:OnGUI () (at Assets/_GameAssets/Scripts/Editor/BuildTool/BuildTool.cs:57)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    Is there anything I can do to make build work?

    edit: I have several errors regarding maximum number of global keywords exceeded.
     
  43. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hey, sorry for the late reply.
    Looking at this, there doesnt seem to be an error thrown from AHP. Its just a log message to tell you that the buildreport has started being processed. There must be something else throwing an error. Could you post the entire editorlog - or send it to contact@heurekagames.com. Then I can help you figure out what is going on.
     
    Styxu likes this.
  44. mathieso

    mathieso

    Joined:
    May 17, 2020
    Posts:
    9
    Small suggestion to prevent mistakes. I look at used assets to find folders in the game that are not being used at all. Sometimes, after I delete a folder that's not in use, Unity recompiles stuff, and the AHP window shows again, but is showing unused assets, not used ones. That is, the button selected on the top right of the window has changed, w/o my changing it.

    That could lead to mistakes.
     
  45. mathieso

    mathieso

    Joined:
    May 17, 2020
    Posts:
    9
    Another small suggestion. AHP and Unity's project window sort names differently. I almost deleted _MK Glow Toon MeshUtility RampCreator (at the top of the list in Unity). It shows at the bottom of AHP's list.
     
  46. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Mathieso. I agree, I should make sure to cache that value so it doesnt reset to "unused".
    Thanks for the suggestion, I will add that in one of the upcomming releases
     
  47. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi again. Agree with this too - hadnt even noticed. They should obviously sort the same way - will add that too soon