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

Question Unused Assets in Project - will the final "Release" get bigger?

Discussion in 'Asset Database' started by Art3m1s-G3R, Jan 1, 2023.

  1. Art3m1s-G3R

    Art3m1s-G3R

    Joined:
    Sep 19, 2020
    Posts:
    6
    Hi,
    i have a question as a beginner:

    I use some assets from the Store and i imported them into my Project.
    Some of the imported things, i dont use in the project.
    For example: I have a package of 5 Background-Pictures, but i only use 2 of them at the moment...

    When i now "publish" my project (to WebGL or Steam for example), will the 3 unused pictures are part ob my "publish"? Will the "Endproduct" be smaller if i delete the unused Pictures first from my Project-Assets?

    I know that it doesnt make sense to have assets in the project that are not used... but as a beginner i chose to import everything from my assets... maybe not the best idear, but maybe i need some of the unused thinigs later...

    Thanks for answer!
    Greetings!
    Art
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    No, if these assets are entirely unused they will not be included in the build. But it's often difficult to make that assessment because the image may be part of a mesh that's part of a prefab that may be in one of your scenes.

    That's why tools like Asset Hunter exist on the store.
     
    Art3m1s-G3R likes this.
  3. Art3m1s-G3R

    Art3m1s-G3R

    Joined:
    Sep 19, 2020
    Posts:
    6
    Thanks for your answer!

    At what "Level" is an asset marked as "used" and will be included in a biuld?

    Example:
    I have a Prefab which includes an Image.
    This Prefab is not used in any Scene...
    Does the image will be included in the build because it is used in an prefab (even if the prefab is not in any scene)?

    So is Scene the "Baseline" where Unity counts assets as used?

    Thanks again!
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    Yes, afaik Unity follows the scene contents (from the build setting's scenes list) to find any referenced assets.

    It will also recognize and use/include specific assets outside any scene, such as render pipeline assets.

    It cannot find whatever is hardcoded in scripts however.

    That is (partially) why the Resources and StreamingAssets folders exist, so you can be sure that assets in these folders are included in a build and will work with code-only resource load operations. StreamingAssets files are stored as-is and can be modified even in a build, whereas assets under Resources are bundled with the build and remain read-only.
     
    Art3m1s-G3R likes this.
  5. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,367
    And most importantly, the search for what assets are used begins with ONLY the scenes listed in the Build settings. It's okay to have fifty Synty demo scenes and special workbench editor scenes that you use for setting up your prefabs lying around in your project. If it's not listed in the Build Settings, the scene's contents are not counted as "used." But don't forget to list out your Additive scenes and Level scenes, or you'll think everything's good until the end of the first level.
     
    Art3m1s-G3R likes this.