Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Remote Content not getting updated

Discussion in 'Addressables' started by zxubian, Oct 15, 2019.

  1. zxubian

    zxubian

    Joined:
    Oct 22, 2015
    Posts:
    14
    Here's my desired workflow:
    During iteration, I would like to decrease build times by only updating assetBundles, and not rebuilding the player if no code has changed. At this time, these assetBundles would be fetched from an Azure blob storage server (or similar service with direct https links to content). For release, I would like to store the assetBundles locally.

    I've made a barebones example to test out this workflow using Addressables, but am experiencing trouble.

    Here's the steps I'm taking:

    0) Made "RemoteIteration" and "LocalRelease" profiles, set up the build & load paths. Selected RemoteIteration as current profile. Enable Build Remote Catalog & set the Remote Path.
    generalSettings.png

    1) made 2 groups:
    ----- group A with 3 textures
    ----- group B with 1 material, referencing texture a1 from group A
    ----- group C with 1 cube prefab referencing material from group B
    ----- group C with 1 ScriptableObject containing a float

    Each group has the exact same setup which looks like this:
    settings.png

    2) Test scene contains prefab cube (the one in group C, but it is not instantiated, just placed inside the scene).
    The cube has a script attached to it which loads the material on Awake and applies it:
    Code (CSharp):
    1.  
    2.     [SerializeField] private AssetReference material;
    3.     private void Awake()
    4.     {
    5.         material.LoadAssetAsync<Material>().Completed += handle =>
    6.         {
    7.             Debug.Assert(handle.IsDone && handle.Status == AsyncOperationStatus.Succeeded);
    8.             GetComponent<Renderer>().material = handle.Result;
    9.             Debug.Log($"Loaded asset {material}");
    10.         };
    11.     }

    There is also a test object which loads the ScriptableObject and shows its float value:
    Code (CSharp):
    1. [System.Serializable]
    2.     public class AssetReferenceExampleSO : AssetReferenceT<ExampleScriptableObject>{ public AssetReferenceExampleSO(string guid) : base(guid) { } }
    3.     public AssetReferenceExampleSO scriptableObject;
    4.     private ExampleScriptableObject exampleScriptableObject;
    5.     [SerializeField] private TextMesh text;
    6.     private void Awake()
    7.     {
    8.         Debug.Assert(scriptableObject != null);
    9.         LoadAddressable();
    10.     }
    11.  
    12.     private async void LoadAddressable()
    13.     {
    14.         var handle = scriptableObject.LoadAssetAsync<ExampleScriptableObject>();
    15.         await handle.Task;
    16.         Debug.Assert(handle.IsDone && handle.Status == AsyncOperationStatus.Succeeded);
    17.         var so = handle.Result;
    18.         if (so != null)
    19.         {
    20.             exampleScriptableObject = so;
    21.             text.text = so.TestFloat.ToString();
    22.             Debug.Log(so.TestFloat);
    23.         }
    24.     }

    3) Build > Build Player Content. Then upload to blob storage.

    >>>Works as expected both in Editor (PlayMode script: Packed Mode) and in Build&Run on Windows.

    4) Change some parameters:
    ---- update float value in scriptableObject
    ---- make material reference different texture (a2) from group A

    Changes are not reflected when playing in Editor with Packed Mode and running the executable from step 3 (as expected).

    5) Addressables > Build > Prepare For Content Update
    >>>No changes


    Skipping Prepare for Content Update on 5 group(s):
    Group Did Not Contain BundledAssetGroupSchema (1 groups):
    -Built In Data
    Static Content Not Enabled In Schemas (4 groups):
    -Default Local Group
    -ScriptableObjects
    -Materials
    -Textures

    Addressables > Build > Build For Content Update & Upload 2 new files

    >>>Still no changes, neither in Editor nor in build Player. (Expected? Because all groups are not static? Not sure why new files are being generated, though)

    6) Addressables > Build > Build Player Content & Upload 2 new files

    >>>Changes show up in Editor with Packed Mode, but not in Player.

    A peak inside StreamingAssets/aa/Windows/StandaloneWindows64 shows only 1 bundle file for the defaultLocalGroup, while the remote group bundles are not present.


    _______________
    I have a couple of questions:

    1) What can I do to make this work? (obvious one)
    2) How would I go about debugging this? The Addressables Profiler doesn't tell me where it's getting my bundles from (i.e. from the server or from the local cache or whatever). How can I visualise & trace the process of my bundles being fetched?
    3) I would like the updated bundles to be automatically uploaded to the server once the Build Player Content (or Content Update?) has finished. I have a script that does this when I press a button in the Editor, but I would like to hook this step to the pipeline. Where would be a good place to look?
    4) I would like to iterate on textures and models separately from the game logic. However, seeing the complete scene in the editor is important for my artists, so I cannot have an empty scene and instantiate everything once I hit play. Is there a recommended approach/method of organizing addressables to match this use-case? Would it be better to load the entire scene from the assetBundle?

    I would be very grateful for any guidance.

    Andy
     
  2. zxubian

    zxubian

    Joined:
    Oct 22, 2015
    Posts:
    14
    Forgot to mention system details, and the forum isn't allowing me to edit the post for some reason:

    Unity version: 2019.2.8f1
    Addressables package version: 1.2.4
     
  3. zxubian

    zxubian

    Joined:
    Oct 22, 2015
    Posts:
    14
    After spending some more time fiddling around, I have come up with the following:

    1) the problem was that my script responsible for uploading to Azure Blob Storage would only upload files that were not present on the server. Thus, the catalogs would never get updated. Modifying the script to check the hash, and then upload the catalog if the local has != the remote hash fixed the problem.

    The correct workflow is:
    Build Player Content & Build Player => Make Changes => Prepare & Build Content Update => Upload updated catalog & new bundles (if any).

    2) For debugging, using the
    ADDRESSABLES_LOG_ALL
    compiler flag helped a lot. Somehow, I'd missed this bit in the documentation.

    Still experimenting with 3) and 4) ...