Search Unity

Asset Hunter (Project cleaning tool)

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

  1. vice39

    vice39

    Joined:
    Nov 11, 2016
    Posts:
    108
    Hey all.

    I installed Asset Hunter Pro with the goal of finding and deleting the many unused textures in my project. I did a build and clicking on the list of "Unused" assets, and it's showing many textures that are in fact in use, some in several scenes.

    Any ideas what am I missing here?

    Unity 2019.4
     
  2. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi vice

    Sorry to hear you are having problems. It should definitely not happen that referenced textures shows up as being unused.
    My first though is that the scenes that are using those textures are not added to buildsettings?
    If the scenes that reference the textures ARE added to buildsettings, then I need some more info about how? Is in stored in the scene itself, is it loaded at runtime, through asset bundles? through addressables?

    You are welcome to respond here, but you can also write me directly at contact@heurekagames.com
     
  3. vice39

    vice39

    Joined:
    Nov 11, 2016
    Posts:
    108
    Yes, that was the problem. I didn't realize it took into account only the scenes that are in the build settings.

    Thanks
     
  4. akarpinski_unity

    akarpinski_unity

    Joined:
    Dec 27, 2017
    Posts:
    4
    Hi vice,

    Asset Hunter doesn't seem to work properly with addressable assets when they are referenced by AssetReferenceXXX classes. All assets and their dependencies are marked unused.
     
  5. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Hi, I have mailed you as well and though if you received it or not. I am using your asset which I bought a few weeks ago. It's very helpful in many features but I am facing a difficulty in having view of assets by TYPE. As you can see in the image attached, though I have clicket SORT BY TYPE but still it is sorting by name. I am using unity 2019.4.5f1. Can you please have a look. AHP issue.png
     
  6. ChromazoneX

    ChromazoneX

    Joined:
    Mar 13, 2019
    Posts:
    12
    Hello! Upon initial setup of AssetHunterPro, it begins building for about a minute and then crashes with this error. It is a pretty large project, but I'm not sure why it keeps crashing? I am using Unity 2020.2.1f1
     

    Attached Files:

  7. awais21

    awais21

    Joined:
    Jan 9, 2018
    Posts:
    31
    import that and this error pops up,imported it on a empty gamy project
    unity version: 2019.4.15f1
     

    Attached Files:

    • 3.JPG
      3.JPG
      File size:
      64.8 KB
      Views:
      325
  8. Leniaal

    Leniaal

    Joined:
    Nov 7, 2012
    Posts:
    119
    I kind of miss this functionality as well. Especially when cleaning up after importing third party assets. They are all in different root folders, so they aren't subfolders. Maybe only disable the option of the selected folders are subfolders?

    Or optionally disable the auto rescan after deleting, because that costs the most time.
     
  9. Kristianlhj

    Kristianlhj

    Joined:
    Jul 2, 2020
    Posts:
    2
    Hi Leniaal, thanks for your feedback. Its great for me to hear what you guys think so I can continue evolving AHP.
    I will see what I can do to alleviate this problem
     
  10. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    @Kristianlhj Any news on this?
     
  11. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Still waiting to hear from your side. Thanks.
     
  12. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi GameHourStudio

    So sorry for not responding to your pervious post. Dont know what happened - completely missed it for some reason.
    Just tried to reproduce your issue, and it does indeed seem to be a problem. I will look into it asap
     
    Last edited: May 22, 2021
    WaqasGameDev likes this.
  13. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi awais, sorry for the late response. I completely missed your post for some reason, didn't get email notification :(

    This is a problem with how Unity deals with AssemblyDefinition files, it basically changed between two releases, which sometimes causes issuus with AHP.

    See fix here: https://forum.unity.com/threads/asset-hunter-project-cleaning-tool.274173/page-7#post-5616655
     
  14. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi ChromazoneX

    For some reason I missed your (and 2 other posts) - didn't get email notification... Sorry about that.
    I have never seen that issue before, could you write me at contact@heurekagames.com then I will see if I can figure out the root of the problem (If it still exists)
     
  15. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I found a fix and will submit it for next version, untill then you can replace the old 'AH_TreeviewElement' file with this
     

    Attached Files:

    Last edited: May 22, 2021
    WaqasGameDev likes this.
  16. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Thanks for speedy responses.
     
  17. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Thanks for calling it a 'speedy' response since you originally asked the question in december :(
    I just submitted a new version (1.3.7) which should be live in the beginning of next week after Unity has reviewed it.
     
  18. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Haha. No it is ok. I understand humans make mistake. But when you noted my message, you solved issue quickly. So I called it speedy. Cheers!
     
  19. Swah

    Swah

    Joined:
    May 13, 2015
    Posts:
    80
    @KristianHJ I'm hitting the same problem as some users in this thread - all scenes in addressables and their dependencies are marked as unused. Is there a workaround for this?
     
  20. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Swah. Sorry to hear you are experiencing problems. I will see if I can repro asap.
     
  21. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Ok, I found the problem. It has do do with how different unity versions deals with references in assembly definitions.
    It will take some time to make a foolproof solution, but a temporary solution is:

    1: Delete "AH_AssemblyDefinition" file
    upload_2021-6-9_14-4-34.png

    2: Add this line of code in beginning of "AH_SerializedBuildInfo.cs"
    Code (CSharp):
    1. #define ADRESSABLES_1_2_0_OR_NEWER
    upload_2021-6-9_14-7-5.png

    Now everything should work as intented.
    Obviously this is not a great solution, but its quite complex to solve for all versions of Unity, so it will take a little while for me to come up with a proper fix.

    Regards,
    Kristian
     
  22. Swah

    Swah

    Joined:
    May 13, 2015
    Posts:
    80
    Awesome, thanks @KristianHJ I'll try that in the upcoming days
     
  23. SeanTazzik

    SeanTazzik

    Joined:
    Apr 27, 2020
    Posts:
    1
    Hello, I am having similar issues as others including an issue where with the structure of my project's scenes I cannot get it to work correctly. How can I request a refund? For example, this is what I see when attempting to use the asset: https://i.imgur.com/HiAjyMM.png
     
  24. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi SeanTazzik, could you tell me a little about the nature of the issues you are experiencing?
    The image you posted tells you to create a build, as soon as you have done that the AHP window will be populated with your project structure, and it will tell you which files are unused.

    so:
    1: Open AHPRO
    2: Create a build
    3: Now you can delete unused files

    If you have any problems after that feel free to write me at contact@heurekagames.com and I will help you out.
     
  25. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Just released version 1.3.8 which fixes an issue some of you guys have had with Addressables support. It only works for Unity versions 2019 and higher due to some limitations with Unity Assembly Definitions in 2018.
     
    MetaZhi and hopeful like this.
  26. WACOMalt

    WACOMalt

    Joined:
    Jul 17, 2012
    Posts:
    11
    I purchased on the asset store with the intent of using this to clean up VRChat projects.
    When using the VRChat SDK, you never really "build" your project, and in fact doing so will fail because the VRChat components arent able to be included in a standalone build. Meaning I either have to remove VRChat's SDK (breaking my project functionally) and make a build, or just not use this tool.

    Is there any way to run this tool without having to make a build? I'm just looking for what I can delete from my project safely.
     
  27. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi WACOMalt

    Sorry, AHP is getting all of its info from the build process itself
     
  28. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    New release 2.0.0

    Added a Dependency Graph which will allow you to inspect an asset and see its dependencies (Both to and from)
    upload_2021-8-24_10-38-48.png

    Also includes a way to get a quick overview in Project Window to see which assets has dependencies to and from (Small icons on the right hand side)
    upload_2021-8-24_10-40-12.jpeg

    Hope you all like it,
    Kristian
     
    Bartolomeus755 likes this.
  29. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    New feature in 2.1.0

    Added "Find Duplicates" feature which will allow you to find any duplicate file in the project:

    duplicates.png
     
  30. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Tinus. Thank you for your suggestions, they have both been implemented in v 2.1.1.
    I have added options for autotriggering the re-analysis in settings (False by default)
    The multiple assets selection has been vastly improved
     
  31. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi leniaal

    This has been added to v2.1.1. You can find a toggle option in settings that will trigger auto re-analysis when project changes (Off by default)
     
  32. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Is this asset compatible with Addressables?

    Also, does this work on latest alpha build currently?
     
  33. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Ruchir

    It does support addressables, but only in 2019 and newer.
    With regards to alpha versions, It doesn't "officially" support it, but it does work just like you would expect except for a single obsolete methodcall which you can just comment out (Unless you are building a Windows Store App)
     
    Ruchir likes this.
  34. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    I changed it with this:
    Code (CSharp):
    1.                         textures.Add(AssetDatabase.LoadAssetAtPath<Texture2D>(PlayerSettings.WSA.GetVisualAssetsImage(PlayerSettings.WSAImageType.PackageLogo, PlayerSettings.WSAImageScale._200)));
    2.  
    Should I choose another resolution/scale for this btw? (Like 100 or 400)
     
  35. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    I would simply delete that line as it seems like 'PlayerSettings.WSAImageType' now also includes PackageLogo, which means that the loop in line 288 will take care of adding everything.

    Code (CSharp):
    1. foreach (PlayerSettings.WSAImageType imageType in Enum.GetValues(typeof(PlayerSettings.WSAImageType)))
    2.                        
    Again, its not officially supported, but I have no doubt this will work

    UPDATE: I just released v2.1.3 which has a fix for this issue
     
    Last edited: Oct 29, 2021
    Ruchir likes this.
  36. Memphizzz

    Memphizzz

    Joined:
    Apr 25, 2021
    Posts:
    3
    Hello,

    before I buy I would like to ask whether or not Asset Hunter Pro also takes into account "Instantiate(myPrefab)" calls in code during run-time for unused assets.

    Thanks in advance!
     
  37. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Memphizzz, it does. Whether the prefab is present in scene, or spawned through script does not matter for AHP, it sees the prefab in both examples as a "used asset".
     
  38. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Please note: In version 2.2.8 AHP has moved out of the "Assets" and into the "Packages" folder to make future upgrades easier and more reliant.

    Unity does however not provide any way to make this move in a good way, so I've written an custom upgrader.
    If you however still get errors after upgrading to 2.2.8, please remove old version and re-import from packages manager.

    Sorry if you encounter this issue, but the move to "packages" means that any future upgrades will be much easier to implement.
     
  39. harsh_agarwal_gamestacy

    harsh_agarwal_gamestacy

    Joined:
    Apr 18, 2022
    Posts:
    5
    Hey Kristian!
    I'm using the latest Asset Hunter Pro. I was wondering if it had the functionality to find and replace all instances of an asset with another?
    Specifically, in half my project I'm using Liberation Sans in TMP. I want to use OpenSans everywhere. Is there a single button that can help me do that? Or do I have to use the dependency graph and go one by one through each scene/object/component?
     
  40. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Harsh

    Sorry to say, it does not have that functionality. Sounds like a valid addition though, I will add it to my backlog, but cant promise anything
     
  41. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    423
    Hello, thanks for the great asset.

    I used the asset to find what's referencing some shaders that I didn't expect to be in the build. It worked perfectly using the dependency graph.

    However, there are some shaders like "Legacy Shaders/Diffuse" that are built-in to the editor. I couldn't make the dependency graph show the uses of those.

    I'm trying to find which used materials are using those built-in shaders. Do you have a recommendation for that?
     
  42. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Meceka. Sorry, but I have immediate answer to that situation. Asset Graph show user assets (not build-in). There might be something I can to to show those, but not 100% sure. I will add your request to my backlog and see if I can figure something out
     
  43. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    423
    Thank you :)
     
  44. trojant

    trojant

    Joined:
    May 8, 2015
    Posts:
    89
    Hi, How does webGL build? Is the window platform build used? Thanks.
     
  45. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Trojant. It doesn't matter which build target you have selected. AHP hooks into the Unity build process and "remembers" which assets are used in that particular build
     
    trojant likes this.
  46. Romaleks360

    Romaleks360

    Joined:
    Sep 9, 2017
    Posts:
    72
    Doesn't Asset Hunter delete meta files or am I doing it wrong? When deleting empty folders all the meta files are left undeleted and unity creates these folders again. It's 2.1.0 AH on 2020.3.34f1 unity
     
  47. Romaleks360

    Romaleks360

    Joined:
    Sep 9, 2017
    Posts:
    72
    Also I am having trouble with AH UI
    1. It's kinda hard to delete many files in AH window. Currently I am manually searching the list of unused assets and selecting those that I can safely delete. One misclick - and all the selection is gone. It would be better to have some checkboxes next to each asset.
    2. The Delete button is gone when selecting multiple folders. Why?
    3. No easy way exists to know if a folder only contains unused assets. I have to check all of the assets in it, switching between unused and all lists (because you can't delete files from used/all lists) Would be great to have a special mark for that.

    Am I missing some other deletion workflow? Searched the docs, seems like there's no other way. Probably it was intended to delete a single file/folder at a time but this is very uneffective as each deletion triggers 2 modal windows, asset database refresh and unused assets list rebuilding. I want first to prepare a batch of files to delete using checkboxes or maybe even a separate list of files to delete.
     
    Last edited: Oct 19, 2022
  48. majidarif

    majidarif

    Joined:
    Sep 11, 2015
    Posts:
    26
    Hello,

    My builds are usually 2min max. But after importing AHP I can't build at all, I even waited for 8 hours but still doesn't finish building.

    In this screenshot it was at "FinishPhase" from 2min up until 8h 50m where I decided to just force close the Unity Editor.
    Tried couple of times but none finished.

    upload_2022-10-21_9-27-33.png

    My project is about 100GB based on size from windows explorer.
     
  49. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi Romaleks. Thank you for your feedback.
    1: To be honest I never thought about that particular workflow with using the search to extensively while selecting unused assets. Your selection Idea sounds reasonable, I will take that under consideration.

    2: If you select folders at the same level you are able to delete. If you select a folder as well as a folder beneath it, I remove the delete button because its imposible to know what the intent here is. (Delete only 'Models', delete verything in 'PolygonNature', delete everything in 'PolygonNature' exept 'Models'? I can know, so you are not allowed to select nested folders. (This is a relatively new feature to allow for multifolder selection, so you might want to update)

    upload_2022-10-21_10-56-22.png

    3: I dont think you really need to know if folder only contains unused. The 'Delete' button only deletes unused, never used assets. If you have a usecase that requires you to have the delete button in the "All" section, please let me know.

    upload_2022-10-21_11-0-7.png

    Again, thank you very much for your feedback, it really helps me evolve AHP. I will definitely consider doing some changes regarding (1). I might also need to be clearer in the UI regarding multifolder selection + inform the user that "Delete" will ever ONLY delete unused regardless of there being used assets in folder.
     
    Romaleks360 likes this.
  50. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    350
    Hi majidarif

    That's obviously horrible. AHP should only kick in when the build is in fact completed so it shouldn't interfere with build times. Is there any errors in log? What happens if you remove AHP, does it return to being a 2min build.