Search Unity

Question Any way to determine unused assets, with Asset Bundle awareness?

Discussion in 'Asset Bundles' started by DaveA, Oct 4, 2021.

  1. DaveA

    DaveA

    Joined:
    Apr 15, 2009
    Posts:
    310
    I have a pretty large project, which has a lot of folders containing assets which get built into Asset Bundles. Those folders often contain unused assets, like textures and meshes, that the artist delivered as alternate or work-in-progress, and did not clean out.
    I found a few scripts and assets on the Asset Store that hunt down unused assets, but they do not seem to be AB-aware, meaning, they will list all the files which are used ONLY in asset bundles as unused.

    Does anyone know of a tool which will be able to identify truly useless files, whether there are asset bundles or not?
     
  2. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    Hi. Maybe Asset Hunter from heureka can do it. But I am not sure.
     
  3. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    One trick can be to create a script that collect dependencies of you scene.

    Code (CSharp):
    1. GameObject[] go = Selection.gameObjects;
    2.  Selection.objects = EditorUtility.CollectDependencies(go);
    And you save sprite names and others stuff in a file. You can then check one by one which sprite is used in your scene and delete others.
    It is long and hard work.