This Unity project aims to investigate and test the isolation of all AssetBundles' BuildCache and artifacts outside of the Library folder. This project uses the Addressables and ScriptableBuildPipeline APIs.
- Unity version: 2020.3 LTS
- ScriptableBuildPipeline version: 1.19.2
- Addressables version: 1.18.19
In order to build Addressables with the custom Library settings, select Window > Asset Management > Addressables > Build Addressables only. After building, you'll find all the produced cache and artifacts stored in "/CustomLibrary/" folder instead of the deafult "/Library/" folder.
- Create a custom build script that uses the Addressables API with a custom build function that is exposed to the Editor. Detailed approach can be found here.
- Before calling AddressableAssetSettings.BuildPlayerContent, set the Addressables.LibraryPath to the desired location (e.g Addressables.LibraryPath = "CustomLibrary/") This will change location of the produced artifacts from the Assetbundle build (e.g. all platform specific artifacts).
- Then you'll need to allow modification in the ScriptableBuildPipeline package. Moving the com.unity.scriptablebuildpipeline folder from “Library/PackageCache" to “Packages” does the trick.
- Inside the ScriptableBuildPipeline package, modify the k_CachePath string in BuildCache.cs to the desired path. (e.g. k_CachePath = "CustomLibrary/BuildCache/"). This ensures the AsseBundle’s BuildCache will be produced in the desired folder.
- Build the bundles using the custom build function.
- Assets are taken from AddressablesMemoryOptimizations project.
- Extra Assets used from this Asset Store package.