Search Unity

Addressables - RemotePath not changing

Discussion in 'Addressables' started by KBaxtrom-LevelEx, Apr 27, 2020.

  1. KBaxtrom-LevelEx

    KBaxtrom-LevelEx

    Joined:
    Feb 5, 2018
    Posts:
    28
    I'm running building two sets of content and having the client choose the version to load at runtime.

    If I update the RemoteLoad in the editor from ...Addressables/A to .../Addressables/B the changes don't appear to work. It continues to load the old path.


    Scene 'Assets/LXProjectExample/Scenes/SphereScene.unity' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
    To add a scene to the build settings use the menu File->Build Settings...


    upload_2020-4-27_8-33-4.png

    upload_2020-4-27_8-47-10.png


    Similar Post:
    https://forum.unity.com/threads/make-the-same-build-load-different-version-of-bundles.754160/


    I'm a little confused about the workflow that's expected. If I want to test two versions of the remote content with the same player. We're researching addresses to see if this is a viable path for us. Should we be using the prepare for content update feature instead?

    Using Remote Content Version A
    Build Player Content
    Upload to Bucket A
    Modify Remote Content for Version B
    Build Player Content
    Upload to Bucket B

    Client Can swap between A and B by changing the RemoteLoadPath.
     

    Attached Files:

  2. KBaxtrom-LevelEx

    KBaxtrom-LevelEx

    Joined:
    Feb 5, 2018
    Posts:
    28
    Some update

    The content workflow for making changes to a player with a static path work fine:

    BuildPlayerContent
    Deploy to S3
    Make Change
    Build Content for Update
    Deploy to S3


    [URLBase]/[BucketName]/Addressables/[BucketVersion]/[BuildTarget]
    BucketVersion={LXProjectExample.ExampleGameManager.VERSION}

    ExampleGameManager.VERSION is a publish static variabe defined in a LXProjectExample asdef

    When trying to use a more dynamic path using Variables. I'm hitting a lot of this error and can't figure out what I'm doing wrong. Is there a way to debug the runtime path being used?

    I'm using a text input to change the static variable at runtime.

    Exception encountered in operation Dependencies: The ProvideHandle is invalid. After the handle has been completed, it can no longer be used

    Build Player Content
    Deploy to S3
    Verify it Works
    Make Change
    Build Content for Update
    Errors
     
  3. KBaxtrom-LevelEx

    KBaxtrom-LevelEx

    Joined:
    Feb 5, 2018
    Posts:
    28
    For some context, we want to be able to QA our assets before pushing them to live, we'd like to be able to have developers test and share their changes with other developers before submitting changes. We'd have more flexibility to choose the catalog and then it would be business as ususal from the code side.


    public void LoadNextLevelDynamic()
    {
    Addressables.InitializeAsync().Completed += (initOp) =>
    {
    string url = string.Format($"{S3Root}/{ExampleGameManager.VERSION}/StandaloneWindows64/catalog_root.json");
    Debug.Log(url);
    Addressables.LoadContentCatalogAsync(url).Completed += (loadCatalogOp) =>
    {

    if (loadCatalogOp.Status == AsyncOperationStatus.Succeeded)
    {
    Addressables.LoadSceneAsync(nextScene);
    }
    else
    {
    Debug.Log(loadCatalogOp.Status);
    }
    };
    };

    }


    What am i missing?
     
  4. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    970
    That data is actually baked into settings.json and the addressables catalog. There is however an easy built-in way to achieve what you want. So, in paths like that, variables in square brackets are evaluated at build time. Variables in curly braces, however, are evaluated at runtime. We have our remote path contain something along the lines of
    {NetworkManager.Instance.AssetLoadPath}
    for that purpose.

    Edit: Having read your subsequent posts, you are obviously aware of that already. What errors are you getting?
     
    Last edited: Apr 30, 2020
  5. KBaxtrom-LevelEx

    KBaxtrom-LevelEx

    Joined:
    Feb 5, 2018
    Posts:
    28
    Sample errors below

    I just have an asset reference to a scene that has a sphere where I am changing the material on it.

    Here's my workflow in the editor as my test case. Test case in a windows build appers to be the same
    Build Player content -> Upload ServerData to S3 (https://URLBase/Bucket/Addressables/V1)

    Make a local change to the scene just to prove that it will be overridden by the
    Boot application and load from V1 bucket
    It works!

    Make another change
    Build Player content ( prepare content update) -> Upload ServerData to S3 (https://URLBase/Bucket/Addressables/V2)
    Boot application and load from V1 bucket -> Errors (see below)
    Boot application and load from V2 bucket -> Errors (see below)
    Upload ServerData to S3 (https://URLBase/Bucket/Addressables/V1)
    Boot application and load from V1 bucket


    Exception encountered in operation Resource<IAssetBundleResource>(defaultlocalgroup_unitybuiltinshaders_c2bbe0760ba5b1123ec70bc8a321b796.bundle): Invalid path in AssetBundleProvider: 'Library/com.unity.addressables/StreamingAssetsCopy/aa/Windows/StandaloneWindows/defaultlocalgroup_unitybuiltinshaders_c2bbe0760ba5b1123ec70bc8a321b796.bundle'.


    Exception encountered in operation Resource<IAssetBundleResource>(defaultlocalgroup_unitybuiltinshaders_c2bbe0760ba5b1123ec70bc8a321b796.bundle): The ProvideHandle is invalid. After the handle has been completed, it can no longer be used
    UnityEngine.AddressableAssets.Addressables:LoadSceneAsync(Object, LoadSceneMode, Boolean, Int32)
    ExampleGameManager:<OnLoadClicked>b__5_1(AsyncOperationHandle`1) (at Assets/Scripts/ExampleGameManager.cs:18)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ChainOperation`2:OnWrappedCompleted(AsyncOperationHandle`1)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ResourceManager:Update(Single)
    MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)


    Exception encountered in operation Dependencies: The ProvideHandle is invalid. After the handle has been completed, it can no longer be used
    UnityEngine.ResourceManagement.AsyncOperations.GroupOperation:OnOperationCompleted(AsyncOperationHandle)
    DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.AsyncOperation:InvokeCompletionEvent()
     
    Last edited: Apr 30, 2020
  6. KBaxtrom-LevelEx

    KBaxtrom-LevelEx

    Joined:
    Feb 5, 2018
    Posts:
    28
    Should I be able to handle all this with code instead of relying on the profile settings? By loading the catalog manually this does not seem to actually use the catalog at all.

    What's confusing is that I would break the player after doing a content update without deploying the content.

    I ended up trying to use the Runtime parameters in the remote config.

    Build Player Content -> S3 V1
    Build Content Update -> S3 V2
    Build Content Update -> S3 V3

    And can swap between them without error sometimes. Sometime I get this error after doing a "Build For Content Updae". Not sure what I'm doing wrong here

    By loading a catalog manually is there another path that I need to initialize? After loading the catalog
     
    Last edited: Apr 30, 2020
  7. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    I've got also difficulties to update my remote content with a scene. @KBaxtrom-LevelEx do you know of a way which AB (url) is downloaded for
    Code (csharp):
    1. Addressables.LoadSceneAsync(nextScene);
    ? It should point to the updated AB on your server. Do you use hashes for AB names?
     
  8. KBaxtrom-LevelEx

    KBaxtrom-LevelEx

    Joined:
    Feb 5, 2018
    Posts:
    28
    I've been using the AssetReferencer Object. I did end up getting something working. I don't particularly like not having the flexibility to call LoadCatalog myself and handle that part. It's a little to much black box magic

    Build Player Content
    Build Content for Update
    Build Content for Update


    Code (CSharp):
    1. public class ExampleGameManager : MonoBehaviour
    2. {
    3.     public UnityEngine.UI.InputField inputField;
    4.     public static string BUNDLE_VERSION;
    5.     public AssetReference nextScene;
    6.     public void OnLoadClicked()
    7.     {
    8.         Addressables.LoadSceneAsync(nextScene);
    9.     }
    10.     public void OnInputUpdate()
    11.     {
    12.         ExampleGameManager.BUNDLE_VERSION = inputField.text;
    13.     }
    14. }
    upload_2020-5-6_13-44-32.png
     
  9. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    154
    I don't know where this is in documentation, or if it even is documented anywhere. But I'm pretty sure once your addressable stuff has initialized, you can't change the remote catalog path.

    You can change it before it initializes, but it will be stuck on that url if you used it.

    It might be that how your code is setup, you are trying to do something with your addressables before you select which path to use.

    My project can retarget the remote path depending on what server it connects to. It sounds like I have a similar setup to you with s3 and everything. We can switch fine, but once its set and has been used, it can no longer be changed.
     
    silentslack likes this.
  10. KBaxtrom-LevelEx

    KBaxtrom-LevelEx

    Joined:
    Feb 5, 2018
    Posts:
    28
    How are you initializing your catalog?

    Could you drop a code snippet?
     
  11. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    You have to call LoadContentCatalogAsync in order to update catalog at runtime.