Search Unity

Building Addressables Bundles in Batch Mode

Discussion in 'Addressables' started by james7132, Aug 14, 2018.

  1. james7132

    james7132

    Joined:
    Mar 6, 2015
    Posts:
    166
    I currently have a continuous integration system set up to build bundles using Unity in. batch mode. It seems like the bundle build is currently tied to pressing the Build button in the build settings. Is there currently a way to invoke a bundle build from batch mode? In other projects using Unity Cloud Build, is there an API we can call to invoke a build from a pre-export method?
     
  2. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,011
  3. Chazmus

    Chazmus

    Joined:
    Jun 12, 2018
    Posts:
    3
    BuildScript.PrepareRuntimeData() Doesn't seem to exist anymore. I'm really struggling to figure out how to build addressable bundles/catalogs headlessly on our build server. Any help with this would be hugely appreciated
     
  4. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    This is how you build content now:

    Code (CSharp):
    1.             AddressableAssetSettings.CleanPlayerContent();
    2.             BuildCache.PurgeCache(false);
    3.             AddressableAssetSettings.BuildPlayerContent();
    Works fine in our CI pipeline.
     
  5. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    Quick question, why would you purge the build cache every time? Unless you don't care how long builds take of course. :p
     
    Andrey-Postelzhuk likes this.
  6. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    Because this function is called when clean the build cache via Addressables GUI. And we had an issue with wrong shaders being compiled into bundles in CI before adding this.
     
    Andrey-Postelzhuk likes this.
  7. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    Interesting! We have had no such issues, we just have to remember to occasionally clean the cache when it takes too much space.