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 Content Update builds fail on Unity Cloud Build - what is the right workflow?

Discussion in 'Addressables' started by mike6502, Feb 16, 2023.

  1. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    42
    (I posted this question over in the Unity Cloud Build forum (https://forum.unity.com/threads/wha...r-addressables-content-update-builds.1397560/), but got no response. Maybe folks here can help.)

    Is anyone using Unity Cloud Build to create Addressables Content Update builds? If so, what workflow is working for you?

    I can successfully create Addressables Content Updates locally using the instructions in the Addressables documentation: https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/ContentUpdateWorkflow.html.

    However, the same process fails on Unity Cloud Build. I have a master branch in git, with a UCB build target that always builds the app with addressables successfully. I also have a content update branch, with its UCB build target set to:
    - Make content-only build
    - Make a content-update build
    - "Content state file produced from another build target" is set to point at the build target for my master branch

    The build always fails with errors reporting a "missing bundle file".

    Again, everything works fine locally, so I'm trying to figure out what's going wrong on UCB.
     
  2. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    42
    (bump)

    I suspect that no one actually uses Unity Cloud Build for Addressable Content Updates.
     
  3. timtunity3d

    timtunity3d

    Unity Technologies

    Joined:
    Oct 1, 2015
    Posts:
    124
    I just setup some configurations in my test project and verified this still worked. I have two configurations. One is my Player Build, and one is my Content Build. Note: In the examples below I cleared out my API key, but you'll need one for this to work.

    Here is the player build configuration:

    upload_2023-2-22_13-20-54.png

    After building it my CCD bucket has my bundles and addressables_content_state.bin:

    upload_2023-2-22_13-22-8.png

    Here is the content update configuration. I choose "Preserve the Existing content delivery bucket" so the addressables_content_state.bin isn't deleted. But that shouldn't be necessary in practice.

    upload_2023-2-22_13-27-16.png

    And here's the bucket with the content only build added.

    upload_2023-2-22_14-31-48.png

    Is that how you have your configuration setup?
     
  4. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    42
    Thanks for your reply @timtunity3d. My configuration is identical, with two exceptions:
    1) I'm building for mobile targets, Android and iOS
    2) I am not yet using CCD, so I do not have any of the upload options checked.

    Here's my iOS config settings for my "Master" target. This build always succeeds, and the Asset bundles are included in the IPA, as they are set for "prevent updates".
    Screenshot 2023-02-22 at 2.51.05 PM.png

    The resulting addressables content looks like this:
    Screenshot 2023-02-22 at 3.06.42 PM.png


    And here are the settings for the iOS Content Update target. This build always fails:
    Screenshot 2023-02-22 at 2.52.57 PM.png

    Per the instructions at https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/ContentUpdateWorkflow.html, I have a branch from Master with just the content changes, and that's what my Content Update build target points to.

    The error that causes the Content Update build to fail is this:
    [warning] [2023-02-22T02:11:41Z - Unity] EXCEPTION: FileNotFoundException: Library/com.unity.addressables/aa/iOS/iOS/b71f691215ea8b52e5ac5a89875129e6.bundle does not exist

    I also see numerous warnings such as this:
    CachedAssetState found for (redacted: a game asset) but the previous bundle at Library/com.unity.addressables/aa/iOS/iOS/26347dccb863b683b636712b375f66b7.bundle cannot be found. This will not affect loading the bundle in previously built players, but loading the missing bundle in Play Mode using the play mode script "Use Existing Build (requires built groups)" will fail.
     
  5. timtunity3d

    timtunity3d

    Unity Technologies

    Joined:
    Oct 1, 2015
    Posts:
    124
    So I tried this with my content updates on a branch, and my main player on main, and it still worked for me. I think we're going to need you to file a support ticket for this so we can look at the particulars of your build.
     
  6. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    42
    Thanks @timtunity3d, I'll file a ticket. While I do that, can I ask a couple of questions that might benefit others following this thread?

    1) Per the addressables content update workflow instructions, all of the groups/bundles in my master branch are set for "prevent updates." All of my content by default is included with the build - nothing is remote. Is this the same for you?

    2) Again, following the instructions, when I make a local content update, I manually run "Check for Content Update Restrictions", which creates a new addressables group that contains the updated assets. I then manually change the build and load paths for the new group to be "remote," and everything builds fine, with the new content update bundle in the expected "ServerData" location. But the instructions for UCB simply says to check the "Make a content-update build" option. What is happening on UCB when I check that option? Is it creating a new group automatically? If so, what are the settings for that group?
     
  7. timtunity3d

    timtunity3d

    Unity Technologies

    Joined:
    Oct 1, 2015
    Posts:
    124
    To answer your second question, "Make a content-update build" is basically calling the code in ContentUpdateScript.cs. In theory this should be the same as calling Build->Update a Previous Build in the "Addressables Groups" window.

    upload_2023-2-28_15-5-5.png

    Here are the steps that I did to test this locally:

    a) Create a group with Assets. Mark as local. Mark as "Cannot Change Post Release"
    b) mark a prefab as addressable and add it to the local group
    b) Build player
    c) Switch material on prefab
    d) run "Check for content update restrictions"
    e) add changes to new group
    f) verify new group is remote
    g) run Build->Update a Previous Build

    Does that seem about right?

    I think I've reproduced your issue. It seems to only happen when using a branch for content updates. When I follow the steps above on the same branch I don't have the issue.
     
  8. timtunity3d

    timtunity3d

    Unity Technologies

    Joined:
    Oct 1, 2015
    Posts:
    124
    Just to add to this, the problem is that Cloud Build's Library cache has all previously built Asset Bundles. The Library cache is keyed to your version control branch, so as long as you're on the same branch the bundles you need to build the content update are there. If you use a different branch they are not. I've opened an improvement request with the CloudBuild team to always download the previously built asset bundles, but for the time being the work around is to use a single branch.
     
  9. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    42
    Ah ha, thanks @timtunity3d, that looks like cause of the issue I'm seeing. My test and build steps are identical to yours, where I create a new branch before step 'c'. Thanks for continuing to dig into this.

    Using the same branch for a content update build might be problematic for our pipeline. If I commit a content update change to the master branch, then push it, UCB will automatically kick a new build using our default config. I believe this may also invalidate the Addressables state bin for a content update build target. I'll give it more thought to see if there is workaround single-branch flow that might work for us.

    Thanks for opening the request for the CloudBuild team. That should fix our issues. Is there a way for me to track that request?
     
  10. timtunity3d

    timtunity3d

    Unity Technologies

    Joined:
    Oct 1, 2015
    Posts:
    124
    I'm trying to find if there's a way to track the bug. I wish I had a better workaround than a single branch. In the past I've set this up with my Full Build configuration setup to only build manually, and the content build configuration to build on every commit. You are correct that if you re-build the full build every time it potentially destroys the content state.
     
  11. timtunity3d

    timtunity3d

    Unity Technologies

    Joined:
    Oct 1, 2015
    Posts:
    124
  12. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    42
    Done, request #1501640. Thanks again for your help.
     
  13. Mild-Mania

    Mild-Mania

    Joined:
    May 16, 2013
    Posts:
    11
    Hey @mike6502 did you find any workaround for this problem? We are having the same issue atm.
     
  14. mike6502

    mike6502

    Joined:
    Oct 5, 2016
    Posts:
    42
    The only workaround I could see was to do the content-update build locally with source content-state artifacts downloaded from the Cloud Build main branch. But this is not compatible with my CI/CD workflow, so I haven't tried it.

    I received a recent email update from Unity to confirm that the support ticket for this is still open (case UCB-7488), and on the Build Automation team's backlog.