Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to force builds to not import unused assets ?

Discussion in 'Editor & General Support' started by Danny9421, Aug 24, 2023.

  1. Danny9421

    Danny9421

    Joined:
    Mar 21, 2022
    Posts:
    32
    I'm currently using Unity version 2021.3.25f1 and building for Android (Android App Bundle).

    Recently, I downloaded VFX assets from the Unity Store. Surprisingly, after importing these assets into my project, my build size increased from 100MB to over 150MB, even though I haven't utilized any of these assets within scenes, scripts, or other aspects of my project yet.

    According editor.log Unity do import everything within my project folder, referenced or not. Changing the stripping level to "high" have not helped aswell.

    I'm wondering if there exists a setting that can be enabled to prevent importing of unused scripts, images, materials, models, ... in my build.

    If there is nothing unity can do, what is the best way to find "unused assets" and get rid of them ? Im using a asset with 100 scripts + and i dont know which is needed for basic functionality. I like to keep as many textures as possible aswell, when building effects with particle system its helpful having a lot of stuff available inside the project.
     
    Last edited: Aug 24, 2023
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Unity should only be including what's referenced in scenes in your build list, any assets in Resources folders, and any Asset Bundles/Addressables groups included in your build.

    So first question I suppose, are these VFX assets all in a folder called Resources?
     
    Danny9421 likes this.
  3. Danny9421

    Danny9421

    Joined:
    Mar 21, 2022
    Posts:
    32
    Oh god yes, all of them were in my Resources folder. I moved them out and my build has normal size again. Thank you so much.

    May could i ask what Asset Bundles/Addressables groups are ? And how i can check if one of those are in my game ?
     
    CodeSmile likes this.
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    If you don't know what they are, they aren't in your project at all.

    Asset Bundles is the old system of organising/loading and unloading assets, often for remote content delivery. Addressables is the new method of doing so.
     
    Danny9421 likes this.
  5. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    PS: stripping level only refers to code stripping, as in stripping unused methods.