Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Feature Request Exclude textures not used in build from compression at build time.

Discussion in 'Editor & General Support' started by Lars-Steenhoff, Aug 3, 2022.

  1. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568
    Can I ask one thing about build times, why are textures compressed during build time that are not going to be part of the build?

    This takes time and disk space while not needed.

    I wish there was a way to exclude them from the compression stage.
     
    evyatron likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,571
    They are compressed at IMPORT time. That's how Unity works.

    Delete them, bring them back with source control if you change your mind.

    Also, if it's just textures you want to keep in there and know you will NEVER ship, you can turn off compression and then they import almost instantly.

    You can also micro-size them to 32x32 via the import settings... last I checked that makes them import pretty fast too, and they won't use much space once imported.

    Otherwise, use source control and aggressively delete old data.
     
  3. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568
    I disable compress on import, I don't need all the textures compressed when I download an asset from the asset store for example.

    But my problem is with builds, why would textures need compressing if they are not part of the build?

    Thats just a waste of CPU cycles and storage and last but not least time.

    Yes there are workarounds, but fundamentally it could be changed so there are no need for workarounds.
     
  4. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,670
    What makes you think that the build process is spending time compressing textures that aren't then included in the build?
     
  5. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568
    I just double checked it,
    1. I created a new project
    2. Project settings ( disable compress on import )
    3. Imported Allsky skybox pack ( 5gb )
    4. Make a build with just the unity sample scene ( add sample scene to build settings )
    5. Press build, Wait for a very long time for all the skybox textures to compress
     
  6. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    The Asset Database does not know what textures are part of the build or not and OnDemand Importing for it is a little ways off still. As a result, all uncompressed textures end up getting recompressed to their platform specific format when the build starts.The compressed result is still an import artifact and it is cached in the asset database, so the second time this runs, only changed textures are recompressed.
     
    joshcamas and Lars-Steenhoff like this.
  7. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568
    Looking forward to ondemand asset importing, I'm targeting mutiple platforms iOS, Apple TV, Android , Mac and I really need to be carefull what asset store packages I import as they take long to compress. Even when only using a little of them. Glad to see this being on the roadmap.
     
  8. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,282
    Is this the same reason why URP runs all possible shader variant combinations (resulting in sometimes up to 14 hours of building, such as with the gigaya project) instead of just the ones included in the build?
     
  9. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568


    This video explains some of the asset database inner workings
     
    _geo__ likes this.