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 Using Release ID with addressable and CDN

Discussion in 'Unity Build Automation' started by Morphus74, Jan 24, 2022.

  1. Morphus74

    Morphus74

    Joined:
    Jun 12, 2018
    Posts:
    174
    Testing Cloud Build and CDN using addressable.

    I made it work fine using badges release (latest), but the issue using latest badge is that each new version break all other.

    So I was thinking to use release method, but is there a keyword to include in the addressable path
    https://(ProjectID).client-api.unit...ases/(ReleaseID)/entry_by_path/content/?path=

    Is there keyword like buildtarget, that will dynamically replace the ReleaseID?

    Thank
     
    Last edited: Jan 24, 2022
  2. ryan_ngo

    ryan_ngo

    Unity Technologies

    Joined:
    Feb 2, 2021
    Posts:
    35
    Hi @Morphus74! This is a great question! If I understand your intent correctly, it looks like you're trying to dynamically replace some parts of the URL that Addressables tries to load from. This is definitely possibly using Profile Variables in Addressables. Documentation can be found here. The idea here is that you could have a static class with your CCD Variables and your Load Path would look something like this:

    https://{CcdManager.ProjectId}.client-api.unity3dusercontent.com/client_api/v1/buckets/{CcdManager.BucketId}/release_by_badge/{CcdManager.BadgeName}/entry_by_path/content/?path=

    Then, at runtime, you'd modify these variables before Addressables initializes. This would allow you to point Addressables to whichever project/bucket/badge desired. Hope this is helpful! Please let us know if you have any other questions.
     
  3. Morphus74

    Morphus74

    Joined:
    Jun 12, 2018
    Posts:
    174
    Thank, I did that in the past with other CDN, but i am now using Unity Cloud Build and Unity CDN and they don't seem to speak to each other about the ReleaseID, being 2 Unity products, I assume there is a way to do that. Mostly since the release can't be known before you build it
     
  4. ryan_ngo

    ryan_ngo

    Unity Technologies

    Joined:
    Feb 2, 2021
    Posts:
    35
    So trying to understand a bit more, you're trying to utilize UCB to modify the url in the Addressables catalog to point to a specific releaseId?
     
  5. Morphus74

    Morphus74

    Joined:
    Jun 12, 2018
    Posts:
    174
    Sorry forget about it, realize that CloudBuild don't support .blend file... so it's useless for me at the moment and i'm not converting all my file to FBX when everything work well
     
    ryan_ngo likes this.
  6. cado82

    cado82

    Joined:
    Jul 29, 2020
    Posts:
    25
    @ryan_ngo That's exactly what I need to do. Do you know how? UCB makes the addressable build and creates a release in content delivery and I want my player build remote url to reference the release id in the bucket.
     
  7. ryan_ngo

    ryan_ngo

    Unity Technologies

    Joined:
    Feb 2, 2021
    Posts:
    35
    Hi @cado82! This involves a little bit of maneuvering but is definitely possible. One way to do this would be to utilize Remote Config and have a config variable called `ReleaseId`. Then using Profile Variables mentioned above, when initializing Addressables, you would reach out to remote config to grab that `ReleaseId` variable and load it to Addressables. This will then tell Addressables to point to a certain release.
    On the build side, what you would need to do is have a Post-build script that updates the remote config variable `ReleaseId` to the release id that is in the bucket.
    Hopefully this gives you an idea of what you could use. Happy to help more if needed.
     
  8. cado82

    cado82

    Joined:
    Jul 29, 2020
    Posts:
    25
    Hi @ryan_ngo, that seems like every build would use the ReleaseId that's in the Remote Config variable if it's evaluated at runtime, no? Or maybe you're talking about the square bracket profile variables that are evaluated at build time? Could you go into a bit more details about how to get the release id in a post build script? Is there a variable I can use for that?
     
  9. cado82

    cado82

    Joined:
    Jul 29, 2020
    Posts:
    25
    Hi @ryan_ngo, did you get chance to look at this? The only thing I'm stuck on now is how to get the release id in a post build script. I can see that the release id is present in the UCB logs but I don't know how to read it from there or whether there is a variable I can use.