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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Asset bundle chunk based compression option

Discussion in 'Unity Build Automation' started by Miguel-Ferreira, Jan 19, 2016.

  1. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi,

    Is there any way to configure the compression options of BuildPipeline.BuildAssetBundles to BuildAssetBundleOptions.ChunkBasedCompression on unity cloud build "Auto-build asset bundle" options?
     
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Currently no, we only build uncompressed bundles. This is something we will look at supporting in the near future.
     
    Iepnew1992 likes this.
  3. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi,

    Thank you. We are basically calling the BuildPipeline.BuildAssetBundles with the options we want on the pre-exported method. Do you see anything wrong with that?

    I also wonder if there is any problem when concurrent builds (ios and android) are building at the same time and are accessing the same path (in our case we build the asset bundles to Application.StreamingAssetsPath) when running that pre-export method.
     
  4. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Building your own asset bundles in pre-export should be fine. You will need to copy them to StreamingAssets yourself though as they won't be copied automatically like the asset bundles built by our process.

    Concurrent builds should have no problem accessing the same path - they won't be running on the same machine so there's no chance of a "collision".
     
    liortal likes this.
  5. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Yes we are building it to the streaming assets path.

    Thanks for all the help!
     
  6. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi there,

    sorry to revive this old thread, but we went ahead with building the asset bundles during the PreExport hook and, while it works, it increases UCB's build failure rates by huge amounts to around 80% (even for same target/commit). If we don't build the asset bundles ourselves and instead use the option provided by UCB the failure rates drop down to basically 0.

    So, we would really like to use UCB's internal asset bundle option, but we need to have compression on, otherwise, our builds end up getting 5/6x bigger. Is there any internal/hacky way of forcing chunk based compression for asset bundle building process?

    The only alternative I can think of is to ensure that asset bundles are already built and placed in the proper folder when we push the code to the repo but that would be too error-prone and generally hard to control.
     
    tonialatalo likes this.
  7. Reichert

    Reichert

    Unity Technologies

    Joined:
    Jun 20, 2014
    Posts:
    63
    I understand this is a point of frustration. Bundle builds in Cloud Build were initially implemented before chunk based compression, when LZMA compression wasn't use as often due to memory constraint issues. Anyhow, the plan is to add compression options. In the meantime I'll see if there's a quick fix that we can do to allow you to specify the option somehow. Stay tuned.
     
    tonialatalo likes this.
  8. Reichert

    Reichert

    Unity Technologies

    Joined:
    Jun 20, 2014
    Posts:
    63