Search Unity

Bundles not updating when assets change

Discussion in 'Addressables' started by SkanskaPaul, Aug 28, 2018.

  1. SkanskaPaul

    SkanskaPaul

    Joined:
    Jun 27, 2016
    Posts:
    6
    I been messing with this for way to long and probably should have posted earlier. Not sure if it is a bug or I'm missing something simple. I converted part of a project to load through addressables and it seems to be working great. The issue I'm having is when I update say a image in a bundle, the bundle doesn't rebuild. It just copies a version from the editor library or temp folders of the project.

    At first I thought this was a remote issue but then I realized it doesn't rebuild for the local bundle. In the editor if I run in Fast or Virtual I see the updated asset, packed does not show the updated asset. Even making a build doesn't do anything different. I get no errors either. I've tried combinations of hitting preview then running app. I even went back to the example project and it did the same thing. The only 2 ways I've been able to get it to update is deleting the library folder and temp folder. The other is moving files around in bundles but it seems to cache each time I do that so if I move it back to a way it was before, it pulls that cached one. If I search and find the bundle in the temp and library folder then delete them, I get a error in the the editor saying it can't copy the bundle.

    This is the last little thing I need to get over but overall I really like this system now that I have messed with it. I am using unity 2018.2.2f1 and I've tried 0.2.1/0.2.2 addressables version. Thanks in advanced.
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Hi, that does sound like a bug, but I need a little more info to get to the bottom of it. For my context, how is this image being put into a bundle? Are you marking the image as addressable? In your game, are you actually loading that image from code? Or is it being referenced by some prefab (that perhaps is also addressable)?

    Thanks for trying out the system,
    -Bill
     
  3. SkanskaPaul

    SkanskaPaul

    Joined:
    Jun 27, 2016
    Posts:
    6
    The image is marked as a Addressable and shows in the Addressables window and version of it loads too. What I have been doing is drawing a number on the image, saving it, then running the project. So say its loading a image that has a "2" on it. I change it to "3" and run the project, it still shows the image with the "2". Just so I can see the difference in the image. If I run it in virtual or fast mode, it shows the image with a "3". If I make a build or used packed mode, it shows a "2". I have also tried this with a prefab and had the same results. I was changing the color of a button in the prefab and it would not update in packed mode. Not sure if it matters but I have this project in Collaborate but I had the same issue in the example project which is not in Collaborate.

    The image isn't being referenced by anything else. I'm creating the a gameobject and adding that Addressable asset to it. Below is the code I'm using to Instantiate it. Before this I am loading all assets that has the label tied to this image. It is definitely complete before this function is called.

    Code (CSharp):
    1. public IEnumerator InstantiateImage(XmlNode source)
    2. {
    3.     GameObject imgGO = new GameObject();
    4.     imgGO.name = source.InnerText;
    5.     var operation = Addressables.Instantiate<Sprite>(source.InnerText);
    6.     operation.Completed += (op) =>
    7.     {
    8.         imgGO.AddComponent<Image>();
    9.         imgGO.AddComponent<CanvasGroup>();
    10.  
    11.         Sprite sprite = op.Result;
    12.         Image image = imgGO.GetComponent<Image>();
    13.         image.sprite = sprite;
    14.         image.preserveAspect = true;
    15.  
    16.         imgGO.GetComponent<CanvasGroup>().alpha = 0;
    17.     };
    18.     yield return operation;
    19.     operation.Release();
    20. }
    I just tried to delete some of the referances to the bundles in the "Library/BuildCache" folder to see if I could trigger it to rebuild and got this error. Not sure if it helps in anyway but just in case.

    Code (CSharp):
    1. FileNotFoundException: Library/BuildCache/b7/b7e85544286ac30800443bbc926d3a3a/dfe8d15f5f279a3027828f7b2e216e47/defaultlocalgroup_assets_all.bundle does not exist
    2. System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:107)
    3. UnityEditor.Build.Pipeline.Tasks.ArchiveAndCompressBundles.SetOutputInformation (System.String writePath, System.String finalPath, System.String bundleName, BundleDetails details) (at C:/Users/paul/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.scriptablebuildpipeline@0.2.0-preview/Editor/Tasks/ArchiveAndCompressBundles.cs:169)
    4. UnityEditor.Build.Pipeline.Tasks.ArchiveAndCompressBundles.Run () (at C:/Users/paul/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.scriptablebuildpipeline@0.2.0-preview/Editor/Tasks/ArchiveAndCompressBundles.cs:154)
    5. UnityEditor.Build.Pipeline.BuildTasksRunner.Run (IList`1 pipeline, IBuildContext context) (at C:/Users/paul/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.scriptablebuildpipeline@0.2.0-preview/Editor/Shared/BuildTasksRunner.cs:50)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
    dnnkeeper likes this.
  4. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    All these details are great! We'll definitely look more into this.

    -Bill
     
  5. SkanskaPaul

    SkanskaPaul

    Joined:
    Jun 27, 2016
    Posts:
    6
    I updated and tried the 0.3.5-preview and it seems to still be happening in there. I can press the Clean -> Build Pipeline Cache button to make it rebuild and work so there is at least a quick work around now.
     
    look001 and dnnkeeper like this.
  6. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    84
    It does work in the editor. But cache in builded player still prevents it from discovering and downloading new asset from the server. I wonder if any kind of version control are ever intended in addressable system. It would be very handy to update server-side assets without rebuilding player so it can download new asset versions automatically.
     
  7. SkanskaPaul

    SkanskaPaul

    Joined:
    Jun 27, 2016
    Posts:
    6
    I only see it working in Fast or Virtual mode. I don't see it work even on local addressable bundles. I thought the old(I guess current)asset bundles had a version system so you could do what you explained.

    I realized after posting about the clean cache working, it still doesn't really fix my issue. After cleaning, the addressable gets a new ID and it seems like a new build of the project has to be made for it to update. My goal is to be able to update some images of projects without having to send new builds.
     
  8. Usama_gss

    Usama_gss

    Joined:
    Aug 30, 2022
    Posts:
    1
    I got the Solution
    The Problem was the Path for the Asset Bundles
    To change it got to Google-> Android app bundle -> Asset Delivery Setting
    And set the correct path to the Asset Bundles Directory