docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Continuous integration

    You can use a Continuous Integration (CI) system to perform your Addressables content builds and your application player builds. This section provides general guidelines for building Addressables with CI systems, but note that every project has its own requirements and constraints, so some guidelines might not apply in all cases.

    Selecting a content builder

    One of the main choices when building Addressables content is selecting a content builder. By default, if you call AddressableAssetSettings.BuildPlayerContent() it uses the BuildScriptPackedMode script as the IDataBuilder instance. The BuildPlayerContent() function checks the ActivePlayerDataBuilder setting and calls into that script's BuildDataImplementation(..)

    If you've implemented your own custom IDataBuilder and want to use it for your CI builds, set the ActivePlayerDataBuilderIndex property of AddressableAssetSettings. By default, you can access the correct settings instance through AddressableAssetSettingsDefaultObject.Settings. This index refers to the position of the IDataBuilder in the list of AddressableAssetSettings.DataBuilders. The following code sample demonstrates how to set a custom IDataBuilder:

    #if UNITY_EDITOR
    using UnityEditor.AddressableAssets;
    using UnityEditor.AddressableAssets.Build;
    using UnityEditor.AddressableAssets.Settings;
    using UnityEngine;
    
    internal class CustomDataBuilder
    {
        public static void SetCustomDataBuilder(IDataBuilder builder) {
            AddressableAssetSettings settings
                = AddressableAssetSettingsDefaultObject.Settings;
    
            int index = settings.DataBuilders.IndexOf((ScriptableObject)builder);
            if (index > 0)
                settings.ActivePlayerDataBuilderIndex = index;
            else if (AddressableAssetSettingsDefaultObject.Settings.AddDataBuilder(builder))
                settings.ActivePlayerDataBuilderIndex 
                    = AddressableAssetSettingsDefaultObject.Settings.DataBuilders.Count - 1;
            else
                Debug.LogWarning($"{builder} could not be found " +
                                 $"or added to the list of DataBuilders");
        }
    }
    #endif
    

    Cleaning the Addressables content builder cache

    IDataBuilder implementations define a ClearCachedData() method, which cleans up any files created by that data builder. For example, the default BuildScriptPackedMode script deletes the following:

    • The content catalog
    • The serialized settings file
    • The built AssetBundles
    • Any link.xml files created

    You can call IDataBuilder.ClearCachedData() as part of your CI process to make sure the build does not use files generated by previous builds.

    Cleaning the Scriptable Build Pipeline cache

    Cleaning the Scriptable Build Pipeline (SBP) cache cleans the BuildCache folder from the Library directory along with all the hash maps generated by the build and the Type Database. The Library/BuildCache folder contains .info files created by SBP during the build which speeds up subsequent builds by reading data from these .info files instead of re-generating data that hasn't changed.

    To clear the SBP cache in a script without opening a prompt dialog, call BuildCache.PurgeCache(false).

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)