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

Addressables.DownloadDependencies doesn't download remote asset bundle

Discussion in 'Addressables' started by yonson_chappers, Apr 4, 2019.

  1. yonson_chappers

    yonson_chappers

    Joined:
    Feb 6, 2017
    Posts:
    33
    I have some code which checks if an asset is present and if not downloads the respective assetbundle. Its taken me ages to get anything working as the documentation doesn't have any clear examples so I've posted my solution below. However, when running this the download gets stuck at 1% and no progress is made, I assume it is just not downloaded it as it can't find it at the url.

    So, I've set up my addressables to make an assetbundle which is a remote build, it builts ok and then I upload it on FTP to my server. I'm using Filezilla in binary so it uploads ok. In the addressables window it is set up for the correct folder to look into.

    This is the code

    Code (CSharp):
    1.       async = Addressables.DownloadDependencies(addressableToLookFor);
    2.         async.Completed += finishedTourAssetBundleDownload;
    3.  
    4.  
    5.  
    6.  
    7.     private void finishedTourAssetBundleDownload(UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation obj)
    8.     {
    9.         if (obj.Status == UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus.Succeeded)
    10.         {
    11.            // do something as we're complete
    12.         }
    13.  
    14.     }
    15.  
    16.     void Update()
    17.     {
    18.         if (async != null)
    19.         {
    20.             txt_busy.text = "Download : " + Mathf.RoundToInt(async.PercentComplete) + "%";
    21.             Debug.Log("ASETBUNDLE DOWNLOAD PROGRESS "+txt_busy.text);
    22.         }
    23.     }
    24.  
    So, I can't see anywhere where I can actually get a check of exactly what url unity is going to to look for my asset bundle, is this available in debug anywhere? and where am I going wrong with this please?
    THanks
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Since addressables is a c# package, you should be able to open your project in an IDE, open Addressables code within that IDE, and set breakpoints. Or at the very least add Debug.Log statements. The file that (down)loads bundles is `AssetBundleProvider.cs`
     
  3. su9257

    su9257

    Joined:
    Jun 13, 2017
    Posts:
    27
    Hi, I also encountered the same problem as you. Is it finally solved?
     
  4. yonson_chappers

    yonson_chappers

    Joined:
    Feb 6, 2017
    Posts:
    33
    no we went another route in the end - unfortunately like a lot of Unity stuff there is a lot of talk about the theory but I think there needs to be far more 'cookbook' stuff of examples of the code in useful ways. We did get the assetbundles to download but its been a while since we looked at the project and I assume the addressables package has moved on!
     
    gijsbeijer likes this.
  5. ThomasRodriguez

    ThomasRodriguez

    Joined:
    Nov 9, 2016
    Posts:
    1
    Hi,

    For the download being stuck at 1%, I had the same problem. Be aware that the PercentComplete property of an IAsyncOperation returns a float between 0 and 1, where at 1 the download is done.
    Also with your Mathf.RoundToInt you're going to print a 1 as soon as PercentComplete is >0.5.

    I don't know about your download problem, as far as I understand the ResourceManagement API I'd say your code should work, but be careful to log the correct values.