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. Dismiss Notice

Question How do I "clean' build when building addressables?

Discussion in 'Addressables' started by AmitChBB, Apr 10, 2023.

  1. AmitChBB

    AmitChBB

    Joined:
    Feb 16, 2021
    Posts:
    36
    Howdy,

    When building addressables through the `Addressables Groups` window, you can clean build data using `Build` -> `Clean Build` -> `All`. This allows us to clean the local addressables data before building for a 'clean' addressables build.

    I haven't found the addressables API to replicate this behavior when building addressables via script. How should I go about this?

    Thanks in advance!
     
  2. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    You can find the APIs here.

    Update:
    The link has been moved to https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/ContinuousIntegration.html.
     
    Last edited: Sep 9, 2023
  3. AmitChBB

    AmitChBB

    Joined:
    Feb 16, 2021
    Posts:
    36
    Thank you very much!

    Just in case the URL breaks in the future, I'll summarize the answer here:
    • In order to clear the addressables content builder cache, you should use the following line (assuming you're using the default data builder or have set your custom one already):
      AddressableAssetSettingsDefaultObject.Settings.ActivePlayerDataBuilder.ClearCachedData();

    • In order to clear the scriptable build pipeline cache, you should use the following line (assuming you want to avoid opening a prompt window because this is for a CI flow):
      BuildCache.PurgeCache(false);
     
    Joserklabater likes this.
  4. Wully

    Wully

    Joined:
    Mar 18, 2014
    Posts:
    15

    Thanks for this, the URL did break in the now your future
     
    AmitChBB likes this.