Search Unity

About the SBP Build Cache

Discussion in 'Addressables' started by einWikinger, Nov 7, 2019.

  1. einWikinger

    einWikinger

    Joined:
    Jul 30, 2013
    Posts:
    97
    We're using Addressables to manage the streaming of our game worlds, which works very well but we found some issue which probably relates more to the SBP than Addressables itself. As we're rebuilding the bundles through the Addressables package very often, the "Library/BuildCache" folder starts to explode. It basically grows on every build with the same size as the package output, which is several gigabytes in our case.

    This often gets into a runaway situation where the BuildCache is several hundred gigabytes in size, basically putting down our build agents because of low disc space. We could work around that by just deleting the BuildCache folder after every build, but that results in build times that are roughly 50 to 100% longer.

    Is there a way to limit the maximum build cache size (similar to the GI cache or asset cache server cache)? Are there settings in the addressables which would result in a more efficient cache re-use?
     
    sadambober, Bzuco and RG_Keith like this.
  2. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    56
    So this is the amount of disk space needed if I want to create just one asset for my game using addresssables:

    1.copy - when you create file in DCC app
    2.copy - when you copy that file in unity Assets folder
    3.copy - in Library\Artifacts
    4.copy - in Library\BuildCache
    5.copy - in Library\BuildCache ...why we need two copies of the same file in cache???
    6.copy - in Library\com.unity.addressables(LocalBuildPath option) OR in ProjectFolder\StandaloneWindows64(BuildTarget option)
    7.copy - final build

    I can save some space and omit 1.copy if I create all my assets directly in Assets folder.
    2. copy - just link file from its original location on disk will be better (similar way as in substance designer)
    3. copy is necessary.
    If 4. and 5. copy cannot be disabled, then I am considering these copies as waste of time and producing garbage on disk
    6. copy - It would be nice if the build process would not create this copy and create just final build instead, but I can live with this copy

    ...it is not only about disk space, but also about SSD disk writes. I already create RAM disk partition for "PlayerDataCache" folder to save some disk life, but I don't have enough RAM to deal with BuildCache folder...it's too much.

    If this cannot be resolved in reasonable way, then I cannot use addressables and need to find another way how to manage and distribute assets for my game.

    For those who want to save some disk space, there is util Link Shell Extension https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html , which can create symbolic links of files...so you don't need to copy your asset files(created in DCC apps) to unity Assets folder, because you will copy just the link(zero bytes).
     
    sadambober and einWikinger like this.
  3. einWikinger

    einWikinger

    Joined:
    Jul 30, 2013
    Posts:
    97
    Just wanted to get back to this and report that the ScriptableBuildPipeline got a configurable build cache size "in the meantime" (not sure when it happened exactly, but probably can be figured out from the changelogs).
    Its size can be modified in the editor preferences or in case you're running headless it can be configured via their API:

    Code (CSharp):
    1. UnityEditor.Build.Pipeline.Utilities.ScriptableBuildPipeline.maximumCacheSize = 100; // in GB
     
    konsnos, pdinklag and crowejohn20 like this.