Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by spanagiotis · Sep 28, 2019 at 08:07 AM · assetbundledownloadable content

Addressables: PercentComplete 0 during asset download.

Hey everyone. Maybe someone can help me out here in understanding the gap in my knowledge. I'm having an issue getting the Addressbles to correctly show their download progress. Below you'll see two screenshots attached. The gray one is my console output, the multicolored one is a standalone build output.

My addresables are hosted in DigitalOcean and are not local to my machine. The size of my packed assets bundle is 10megs and change. When I iterate over each item in my pack I get its the size and then proceed to download it.


EDIT So I've figured out 3 of my 4 issues, the final issue seems to be a bug with Unity possibly? I still cannot figure out why the percent complete does not increase. Does the percent complete only apply to the loading of an asset and does it not take into account downloading progress?

1st Issue: It seems GetDownloadSizeAsync(key) gets the bundles entire file size, and not the size of the asset which was entered for the key in editor.

Solution: When creating a 'packed' assets, the entire asset size is queried regardless of key. To remedy this, each asset needs to be its own pack OR the packets bundle mode needs to be set to pack separately.

2nd Issue: GetDownloadSizeAsync(key) never returns a value for the standalone build.

Solution: This is intended design.

3rd Issue: Progress is always 0 until near the end. (I calculate bytes downloaded as progress*total)

4th Issue: For all assets, after the first key downloaded asset the remainder have an interesting percentage pattern, and now the total bytes for that key always returns 0.

Solution: When accessing a single asset in a packed asset bundle with the mode set to pack together, the entire bundle is downloaded to access that one asset. This means the remainder of items are downloaded and it is loading them.

Code:

 public async Task<LoadedAssetList> LoadAssets(List<string> assetsToLoad)
 {
     LoadedAssetList _loadedAssetList = new LoadedAssetList();
     _maximumPercentageAmount = assetsToLoad.Count;
     foreach (string item in assetsToLoad)
     {
         _loadedAssetList.AddAsset(item, await AddressablesUtil.WaitForAssetToLoad(item, _UpdateLoadedPercentageTotal));
     }
     
     return _loadedAssetList;
 }



 public class AddressablesUtil
 {
     public static async Task<GameObject> WaitForAssetToLoad(string key, Action<double, long, string> percentageCompleteCallback = null)
     {
         AsyncOperationHandle<long> sizeHandle = Addressables.GetDownloadSizeAsync(key);
 
         await new WaitUntil(() => sizeHandle.IsDone);
 
         long b = sizeHandle.Result;
         AsyncOperationHandle<GameObject> loadAssetHandle = Addressables.LoadAssetAsync<GameObject>(key);
         while (loadAssetHandle.IsDone != true)
         {
             percentageCompleteCallback?.Invoke(loadAssetHandle.PercentComplete * sizeHandle.Result, sizeHandle.Result, key);
             await new WaitForEndOfFrame();
         }
 
         return loadAssetHandle.Result;
     }
 }



I assume I'm missing something important about how this is supposed to work but I'm at a loss and I've been working on this all day.

Console output & addressables packer alt text

Standalone build download logs alt text

standalonebuilddownload.png (218.0 kB)
console-download.png (302.2 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by DhiaSendi · Mar 09, 2021 at 05:01 PM

Solved by just changing "obj.PercentComplete" by "obj.GetDownloadStatus().Percent"

 IEnumerator OnLoad(AsyncOperationHandle obj)
       {
           while (obj.IsDone == false)
           {
               yield return new WaitForSeconds(.1f);
               progressImg.fillAmount = obj.GetDownloadStatus().Percent;
               percentCopmlete1.text = obj.GetDownloadStatus().Percent * 100f + "%".ToString();
           }
          
       }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by aka3eka · Feb 17, 2020 at 07:03 PM

Hi spanagiotis, Did you manage to solve the issue #3?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image aka3eka · Feb 17, 2020 at 08:14 PM 0
Share

BTW, there is more info on this issue here: https://forum.unity.com/threads/0-7-4-addressables-downloaddependencies-percentcomplete-always-returns-0.667558/

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

116 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't import any packages? 6 Answers

Is there a way to make DLC in unity without assetbundle? 0 Answers

How Export and Downloading Asset Bundle at runtime? 0 Answers

Using Occlusion Culling with remotely downloaded Asset Package 0 Answers

Asset bundle downloads lagging after upgrading project from Unity 2018.X to Unity 2019.X 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges