Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bundle Manager[Released]

Discussion in 'Assets and Asset Store' started by YinXiaozhou, Jan 8, 2014.

  1. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Bundle Manager[1.2.1]

    Hi everybody,

    I'm an independent game developer. I have worked with Unity for 3 years in game development.

    When working with Unity, I found that the bundle system is pretty frustrating for programmers. It needs so much hard coding works, and you need keep changing the code to adapt the rapidly changing assets structure. So I made this plugin.

    ===============================================================


    Bundle Manager is a Unity streaming solution based on asset bundles which provides a way to create, edit and optimize your bundles without any coding.

    The native Unity bundle management approach usually contains too much hard-coding. The goal of this tool is to get programmer liberated from the resource management work. Let them focus on resource using but not resource packing.

    Features

    Code free bundle management.
    Create and edit your bundles without need to touch code.

    Bundle dependency management.
    Reuse assets in multiple bundles to save your player's time and bandwidth.

    Incremental building.
    Skip unchanged bundles in bunlding to save your time.

    Download priority.
    Automatic runtime priority management. Choose which bundle you want first.

    Bundle verisons.
    Automaticly version number management for unity cache.

    Intuitive user interface.
    Unity native GUI style. Start using Bundle Manager in 10 mins.

    Here's our Official Website | Store Link | Email | Trial Version


    ================================================================
    About Unity 5
    Many questions about new Asset Bundle system Unity 5. So I write my opinion here:
    It's glad to see that Unity finally trying to face this mess.
    BM have lot of common with this new system, GUI only management, incremental building, etc. But we have some design differences on how to deal with bundles.

    1.GUI design. We think streaming solution is a big deal for Games. So we give BM a whole window to deal with it. Compare to Unity's small widgets, BM will be more convenient if you have too many bundles.

    2.Bundle dependency design. We and Unity both agree hard coding dependency management is torment for developers. So in the new system, Unity want manage bundle dependencies automatically. But we think developers need full control on the dependencies.
    Sometimes we just don't want bundle A depend on bundle B, even they have same x asset. Because bundle A or B may have some other assets much bigger than x.

    As a plugin created more one year, we have some small functions Unity don't have.
    Also new system have functions we don't have, like bundle variant. So you should be careful to decide use BM or New Bundle System.

    For now BM will keep working on legacy bundle system. Since the new bundle API is not open enough, that we cannot edit the bundle content. And there's no way to manage dependencies manually. If the new system API keep evolve, once it's ready, we will move to the new API.
    ================================================================


    Here's short tutorial.


    $screenshotDrag.png
    $ScreenshotTreeView.png
    $ScreenshotBC.png
    $ScreenshotConfiger.png
    $ScreenshotAll.png

    New Version!
    1.2.1

    -Added support for WebGL
    -Added method for checking if bundle is cached.
    -Added ability to rewriting priority of bundles in waiting list.
    -Fixed bundle priority cannot be saved in Editor.
    -Added/Fixed some document.
     
    Last edited: Sep 11, 2015
    Gozdek and marsonmao like this.
  2. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    *Bump*. New version compatible with Unity 4.0.0 is now on live!
     
  3. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    I'm considering purchasing this...looks great. However the video does not demonstrate the runtime side. Can you provide some screen shots or a second video on this...my worry is...great now I have them all organized, but how do I download them and use them in my game dynamically at runtime.
     
  4. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Great question.

    We provides DownloadManager for realtime streaming work.
    There's a snippet for DownloadManager:

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class TestDownloadManager : MonoBehaviour
    4. {
    5.     IEnumerator Start()
    6.     {
    7.         yield return StartCoroutine( DownloadManager.Instance.WaitDownload("LE.assetBundle") );
    8.  
    9.         WWW www = DownloadManager.Instance.GetWWW("LE.assetBundle");
    10.     }
    11. }
    The DownloadManager will stream all the requested bundles by their dependencies and priority automatically.
    For example, if you have a bundle tree like this:
    $Screenshot 2014-02-02 15.16.18.png
    You can download bundle LAAAAA directly without care about the depended bundles. DownloadManager will make sure depended bundles be prepared before downloading LAAAAA.

    For more information plz check API Reference

    Also there's a full test case in the Asset Store Package, It's a good example for the new starters.
     
    Last edited: Feb 2, 2014
  5. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    Thanks for the info. And to clarify…I do have Unity Pro…but not Android Pro. Will this asset still work as intended. I assume it just needs the standalone Unity pro which is required to build assets.
     
  6. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    You can't load asset bundle on android if you don't have the Android Pro license.
     
  7. jabi

    jabi

    Joined:
    Feb 5, 2013
    Posts:
    10
    Hi. YinXiaozhou

    I'm purchasing this.. it's very greate tool..

    but. i found bug..

    steps
    1. open bundle manager
    2. create asset bundle( it's name "a")
    - a is empty
    3. create asset bundle(it's name "b", "b" to make "a" sub)
    - b is full(fbx, prefab...etc.)
    4. build
    5. build failed..........
    output log
    Code (csharp):
    1.  
    2. No assets were provided for the asset bundle
    3. UnityEditor.BuildPipeline:BuildAssetBundle(Object, Object[], String, BuildAssetBundleOptions, BuildTarget)
    4. BuildHelper:BuildAssetBundle(String[], String) (at Assets/BundleManager/Src/Editor/Core/BuildHelper.cs:271)
    5. BuildHelper:BuildSingleBundle(BundleData) (at Assets/BundleManager/Src/Editor/Core/BuildHelper.cs:312)
    6. BuildHelper:BuildBundleTree(BundleData, List`1) (at Assets/BundleManager/Src/Editor/Core/BuildHelper.cs:162)
    7. BuildHelper:BuildBundles(String[]) (at Assets/BundleManager/Src/Editor/Core/BuildHelper.cs:122)
    8. BundleTreeWin:BuildSelection() (at Assets/BundleManager/Src/Editor/GUI/BundleTreeWin.cs:611)
    9. UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)
    10.  
     
  8. Lazy

    Lazy

    Joined:
    Oct 5, 2012
    Posts:
    7
    Hi jabi,

    That is not a bug. Bundle Manager cannot build a bundle without any asset, so it complains error messages on empty bundles, and refuse to build the tree which contains that bundle. But it will go on build for other bundles which dose not depend on the empty one.
     
  9. jabi

    jabi

    Joined:
    Feb 5, 2013
    Posts:
    10
  10. jabi

    jabi

    Joined:
    Feb 5, 2013
    Posts:
    10
    Hi. YinXiaozhou ..

    Perhaps now the time to be the sort of Bundle Window

    Sugestion.. add Function.. Sort of BundleName

    - Because a lot of the time the bundle is difficult to recognize.
     
  11. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Yeah, I found it's difficult to find out the target bundle too when there's too many of them.
    Right now the bundles is sorted by the order you add them. Some times it's better than by name.
    I don't really want to just add a sort type button on the toolbar, because I don't want to mess it up.
    Any way I'll try to find out a way to deal with this.

    Thank you for your feed back Jabi.
     
  12. jabi

    jabi

    Joined:
    Feb 5, 2013
    Posts:
    10
    Thanks . YinXiaozhou. Quik support..

    Sorry. More Questions..

    step 1.
    - Use Shader: Unlit/Texture, MatcopShader

    1. Build StandAlone
    2. Load bundle
    3. Fine!!

    1. Build Android
    2. Load bundle
    3. Fail..
    - Pink.pink.. pink..

    step 2.
    1. editor Android Mode
    2. Build Prefab include to Mecanim
    3. Load Bundle
    4. Fail
    - Crash

    1. editor Android Mode
    2. Build Prefab include to Mecanim(add BuildAssetBundleOptions.CompleteAssets)
    3. Load Bundle
    4. Don't Crash.. but Pink.. pink...
     
  13. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    The pink problem may be the shader compatibility issue on android. Can you try a diffuse shader?

    For the second crash problem can you send me the minimal project which can reproduce this? Also what's your Unity version.
     
  14. jabi

    jabi

    Joined:
    Feb 5, 2013
    Posts:
    10
    Thanks Suport..

    step1 .
    - shader issue. i resolve
    step2.
    - Only one Object problem.
    - It's strange...
    - build / rebuild / build all / rebuild all -> bundle size very small(600kb)...
    - but.. Select the project that builds the Object -> bundle size 3mb.. why??(i think.. bug..)

    More Questions

    1. why not use "Cashing.Ready" ??
    2. When use AssetBundle.Unload ??
    3. DownloadManager.Start() not use www.Dispose ... why??
    4. How to use "Sort by Name"?? ( i upgrade 1.0.6 ^^)
     
    Last edited: Mar 6, 2014
  15. Lazy

    Lazy

    Joined:
    Oct 5, 2012
    Posts:
    7
    I don't really get you. Do you mean the size of bundle file is much bigger than the size shows on the Bundle Content window? If that's the problem, it's very weird, because the size shows on the GUI is comes from the file size directly. Plz check it again because it's never go wrong in our project. If you still get that, can you send me the file included in your bundle? Then I can try to build it on my own machine.

    About the other questions,

    1.Caching.Ready is not necessary when use Unity cache, WWW.LoadFromCacheOrDownload is all you need.

    2.If you want to save your runtime memory you can use AssetBundle.Unload on the assets which you never use anymore. But be careful, it's very easy to produce errors if you unload some bundles whose assets is still in using.

    3.In DownloadManager.Start, all WWWs are local variables. System will dispose them automatically when it's running out of the scope.
     
  16. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Hi there,

    1.0.6 is released with a lot improvements(Including sort with name). Go to asset store and check it out.
     
  17. jabi

    jabi

    Joined:
    Feb 5, 2013
    Posts:
    10
    Good Feed Back..

    hm. i updated 1.0.6..
    Ok.. Step 2 is generated randomly.
    - I'll send occurs.

    more question.. ^^;;;

    0. my unity 4.3.3

    1. How to use sort with name

    2. shader name is empty.... ;;;;;
    - editor run(android mode)
    - bundle build(uncompress/compress)
    - startdownload
    - getwww()
    - m_TempSharedMaterials[j].shader.name is empty
    - Shader is Mobile/Particles/Alpha Blended

    Code (csharp):
    1.  
    2.     void RefreshShader(GameObject go)
    3.     {
    4.         m_TempRenderers = go.GetComponentsInChildren<Renderer>(true);
    5.  
    6.         for (int i = 0; i < m_TempRenderers.Length; i++)
    7.         {
    8.             m_TempSharedMaterials = m_TempRenderers[i].sharedMaterials;
    9.             for (int j = 0; j < m_TempSharedMaterials.Length; j++)
    10.             {
    11.                 if (m_TempSharedMaterials[j] == null)
    12.                     continue;
    13.  
    14.                 if (m_TempSharedMaterials[j].shader == null)
    15.                     continue;
    16.  
    17.                 m_TempShader = Shader.Find(m_TempSharedMaterials[j].shader.name);
    18.  
    19.                 if (m_TempShader != null)
    20.                     m_TempRenderers[i].sharedMaterials[j].shader = m_TempShader;
    21.                 else
    22.                 {
    23.  
    24.                     ClientMain.LogError("shader not found!!! - " + go.name + " : " + m_TempSharedMaterials[j].name + " : " + m_TempSharedMaterials[j].shader.name);
    25.                 }
    26.             }
    27.         }
    28.     }
    29.  
     
    Last edited: Mar 7, 2014
  18. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Hi jabi. I tried to write a test similar with your describe, but I didn't get what you got. Can you send us a small project which can reproduce your problem, so we can investigate it.
     
  19. jabi

    jabi

    Joined:
    Feb 5, 2013
    Posts:
    10
    Hi~.. YinXiaozhou!!!..
    Thank you for your interest in giving.

    My Bundle count is 157..

    Are randomly packaged incorrectly :sad::sad:

    Yesterday.. i build all bundle(mayby. all make bundle):sad:

    One file is faulty packaging (quantity seems to be randomly generated)

    I will send your email..(file name "bundle.zip".. so 2 files)

    1. InCorret_04_Emperor_Archer_Keiberth : wrong package bundle
    - file size 339kb
    - step
    -- build all
    -- build success
    -- size wrong..
    -- bundle load fail(random unity crash)

    2. Correct_04_Emperor_Archer_Keiberth : fine package bundle
    - file size 4.27mb
    - step
    - Select InCorret_04_Emperor_Archer_Keiberth
    - delete bundle include
    -- Select a prefab in the project view
    -- bundle window->build selection
    -- fine build

    I hope the bugs are being fixed:):)
     
  20. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Hi, a new version of BundleManager is now live with new features, fixes and a new tutorial!
     
  21. prototype7

    prototype7

    Joined:
    Aug 29, 2012
    Posts:
    12
    Hi there,

    I have found a bug, if you have prefab and the prefab name is more than 16 characters it won't be load but the build succeed.
    eg assetBundle.Load("seventeenCharacters");
     
  22. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    I tested this, but it's fine on my Mac&PC.

    Can you test it again with my test case in the attachment? After import, just run the test scene under testLongName folder. If a white box shows up without any errors then it's fine.

    If it still broken please tell me your target platform and your Unity version.

    NOTE: Backup your local *.txt files under BundleManager folder. The test case will clear your orig bundle settings.
     

    Attached Files:

  23. prototype7

    prototype7

    Joined:
    Aug 29, 2012
    Posts:
    12
  24. _mgonzalez

    _mgonzalez

    Joined:
    Jan 9, 2014
    Posts:
    5
    Hi this Asset is a real time saver, however I do have two questions:

    - Are you planning on adding CRC support? It's a new parameter in the WWW.LoadFromCacheOrDownload method -
    - With regards to versioning, is it possible to manually set the bundle version number - sometimes I might make 10 builds while working on something, but I only want to increment the number once i'm done.


    Great work on this btw!

    -M
     
  25. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Sorry I missed your post. I already reply you by email, but I think it's better to post the answer here for new users.

    We do have a plan on CRC support. It will be added in later version.

    To change the version number manually, you can change the "version" data in BuildStates.txt. But it's not recommend, as it may cause chaos.
    For example, if you have a bundle A at version 0. After 2 times build, the version will be 2. If you download this bundle on your machine in test, then there will be a copy in the cache with version 2.
    If you set the version back manually to 1. But later, you change bundle A and rebuild it. The version will be 2 again. In this moment, if you want to test your new bundle A, you will still get the old A in the cache.

    My suggestion is just let the version increase.. Make sure your bundle is one version one build is very important.
    And you'd better make sure in your studio, there's only one machine have the authority to commit BuildStates.txt to the repo. In our studio we call that Build Machine.
     
  26. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    Hi, GREAT asset! Many Thanks!!!

    two questions:

    1. Some shaders not working when testing in editor, may be a Unity problem:
    Some shaders(for example builtin ones like Unlit/Texture) does not work when the asset bundle that is using them is loaded in the editor. The game objects are all purple in the editor play mode.

    But when the project is built for IOS, all the shaders work on the iPad.

    Is there a solution to this problem.

    2. Can you implement connecting to Amazon S3? There is another similar asset on the asset store that does that, but I would prefer to use yours if you can implement connecting to Amazon S3 without extra code : )

    Thanks again!

    FOLLOW UP:
    In Unity Project settings/Graphics, force to always include the shaders used solved the problem for me. After rebuilding the asset bundles, shaders work in both the editor and on iOS
     

    Attached Files:

    Last edited: Jul 22, 2014
  27. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Thank you for your Q&A :)

    For Amazon S3 uploading.

    Sorry, I don't think this feature is proper for Bundle Manager. Bundle Manager is designed to focus on Bundle Content Management. Since people have varies servers, We leave the bundle uploading process for users to prevent unnecessary coupling.
     
  28. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    What about downloading from S3. How do I modify the download manager to download from S3 with my access keys?
     
  29. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Do you mean that you want to keep your bundles private?
    If you are making a game, in most case you should let your bundles go public on the internet. Because player will get the bundles at last, which means they are public.
     
  30. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    Thanks for the fast reply!

    This is interesting, I am new at using asset bundles, so I did not know I should make them public.

    Even if my game is only on iOS?

    I don't want to make the files on amazon public because I don't want people to be able to download the assetbundle if they know the url to it.
     
    Last edited: Jul 24, 2014
  31. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    OK. Let me explain more about this.

    First, people can always get your bundles even on IOS. They can retrieve your bundles from the disk of cracked iPhone.
    Second, if you have some sort of key. Hackers can get the key out of you app.
    Third, if you are using http protocol for downloading, the key will be sent in the headers. So hackers can get the key by watching you http package.
    So as you can see, you cannot protect your bundles from hackers no matter what you do.

    But the KEY do make the hack a little bit harder on IOS. If you still think it worth the cost, you can change source code of DownloadManager. There's no such standard encryption, so you need to get your hand dirty:)

    BTW, it's late here, I need go sleep. I'll reply you tomorrow if you have more questions.
     
    Last edited: Jul 25, 2014
  32. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
  33. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133

    Sorry, we don't encrypt our asset bundles:) Since the decrypt method can be exposed by reverse engineering(Especially easy for C#).

    Although Bundle Manager dose not provide feature to encrypt and decrypt bundles, you still can add it by your self. Just do the encrypt after asset bundle generated. And do the decrypt process after your bundle load by Bundle Manager.
     
  34. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Hi everyone,

    The new version with CRC support is now released! Check it out on AssetStore.
     
  35. Sam-K

    Sam-K

    Joined:
    Mar 23, 2013
    Posts:
    27
    08-19 13:28:36.895: E/Unity(10394): Download BundleData.txt failed after retried for 3 times.
    08-19 13:28:36.895: E/Unity(10394): Error: java.io.FileNotFoundException: /data/app/com.mindstorm.assetbundletest-1.apk/AssetBundle/Android/BundleData.txt: open failed: ENOTDIR (Not a directory)

    Im getting this error. The bundle in loading correctly in editor but when i test it on andoird device it shows this log.
    the bundle is placed in Application.data/AssetBundle/Application.Platform/name so this is the URL I Hit. Am i doing something wrong ???

    I have also tested it on localserver and on Remote server but it gives the same errors.
    On Remote server On IOS it saying
    Download BundleData.txt failed after retried for 3 times.

    Error: The requested URL was not found on this server.

    My url https://s3.amazonaws.com/snsunity/IOS/

    Kindly reply
     
    Last edited: Aug 19, 2014
  36. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    I relied your mail. I post it here for the late users may have the same issue.

    Can you send me the Url you filled in to the Download Url box in settings panel?

    And also how do you put the bundles into your APK package?

    If you want to load the bundles for your local filesystem on phones, you need to create a StreamingAssets folder in your project, And setup the Download urls for different platform.
    Please check out this for the details:
    http://docs.unity3d.com/Manual/StreamingAssets.html
     
  37. Sam-K

    Sam-K

    Joined:
    Mar 23, 2013
    Posts:
    27
    Yes its working now the problem was with the URL.
    Thanks
    I have a few questions.
    1) Can i Get a list of names of what is inside my bundle. like its shown in the eidtor.
    2) LoadfromCacheOrDwonlaod stores it into the disk but i cant find it anywhere. And if its in the cache it should be loaded quickly but it takes 10-12 sec to load my uncompressed bundle of size 3.5 MB containing 2 imagues. Using Cache option is checked. Should it be really qucik if its getting from local disk/cache. Because the first time it takes a lot more time than this.
    3) compressed Bundle with using cache option unchecked is fast as compared to uncompressed and vice versa.
    4) cant i store the data in the bundle (images for this example) into resources or any folder.
     
  38. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    1.You can get the bundle information from DownloadManager.Instance.BuiltBundles. Note, before read from this property, you should make sure DownloadManager's initial process is finished by checking DownloadManager.Instance.ConfigLoaded.

    2.The cache is managed by Unity system, it stored in different place on different platforms. And you don't need to know where it is.

    Cache must be working in your case. The reason of 10 -12 sec loading is Download Manager need to initial itself by download the configuration files. And these files cannot be cached, since Download Manager alway need to check if the bundles updated.

    In version 1.1.5, we compress the initial datas into single bundle for optimization, so that the initial process can be much faster. You can update your plugin to get that.

    3. There's an issue with compress option before, we fixed it. You can update to the new version to test it again. You can compare the bundle build size in compress or uncompress state, it should be significant.

    4. I don't get this question. You can store your data any where in your project. Any assets in your project can be packed into your bundles.

    Bundle Manager is base on Unity's asset bundle system, we highly recommend you to read the official docs about asset bundle before you using it. Our plugin can make asset bundle much easier for developers, but you still need to know the detail behind it to make your development efficient.
     
  39. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    Hi, I'm getting 22 errors similar to this:
    Assets/BundleManager/Dependencies/LitJson/JsonMapper.cs(91,28): error CS0101: The namespace `LitJson' already contains a definition for `ExporterFunc'

    Maybe your namespace is clashing with another asset I am using?
     
  40. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    SOLUTION:
    Found out that one of my other asset is using the same namespace. I just deleted that file(make sure you don't break the other asset)

    In my case the asset was best HTTP, I just deleted the examples folder.
     
  41. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    In Bundle Manager we use Litjson for serialization, if you have another Litjson already you can delete them. We highly recommend you keep our Litjson version, since we fixed a few bugs in it. The official version will get problem on parsing nesting arrays, and have a few other issues.
     
  42. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    Thanks for the fast reply! Even the the time differences : )

    Can you explain a bit more about the share state indicators? It was a little confusing in the documents. Should we try to eliminate red and yellow indicators? What is the best way to eliminate them? Just put them into the same bundle?

    I want to keep each bundle as small as possible but also to eliminate duplicate information as much as possible, what is a good balance?

    Maybe as a bonus, you could write a "bundle manager" best practice guide?

    Thanks so much!
     
  43. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Bundle Manager Best Practice? Haha, I like this title, seems some thing big:)
    But when designing streaming solutions, every project is different. There's no such best method to manage bundles.

    For the share indicators. Both red and yellow means duplicated assets in your bundles. Difference is red is for include list, yellow is for depend assets.

    The red is easy to understand, more than two bundles included the same asset. You should try to eliminate them to decrease the size wasted.

    The yellow means this asset is duplicated depend by more than two bundles.
    In most case it also means assets duplicated. For example, I have material A and B, they both used the same texture. And I create two bundles to hold this two materials separately. Then this texture will be listed in the depend list and marked as yellow. In this case the texture will be duplicated include in two different bundles.
    But for some special cases it's not. If you used sub meshes in a FBX file to create different parts prefabs and pack them into different bundles. All these sub mesh bundles will depend on the FBX file which will be marked yellow in Bundle Manager. But it won't cause size wasted, since the bundle won't need include the whole FBX file.

    You should try to eliminate the duplicate assets by strip them out and put them into a parent bundle. But too many dependencies between your bundles will cause chaos. You should balance between the bundle size and structure complexity. It's all depend on what your project is, and how you manage your assets. If the red/yellow asset is small you can leave it.
     
  44. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    Got it! Thanks!
    I will test different ways of building asset bundles and see which works best.

    Also, as a request, is the ability to detect prefab changes on the plan? For example, when I make changes to a prefab, the bundle manager will automatically indicate that this asset bundle needs to be rebuild.
     
  45. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Yes.
    In building progress, Bundle Manager will check if any asset in bundle is changed(include dependencies), only build changed bundles.
     
  46. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    After checking the using Unity cache and CRC on, how do I call LoadFromCacheOrDownload? I don't see any functions in http://bm.baxegames.com/reference/html/class_download_manager.html#a89b21d5306d98c4a8eb6ff87c6668e72

    Is there a way to load from cache directly if there is no internet connection?

    Solution:

    Figured it out, here:

    Code (CSharp):
    1.     IEnumerator Start() {
    2.         WWW www = WWW.LoadFromCacheOrDownload ("https://address/IOS/"
    3.                                                + modelName
    4.                                                + ".assetBundle", 5);
    5.         yield return www;
    6.      
    7.         if (!string.IsNullOrEmpty(www.error))
    8.         {
    9.             Debug.Log (www.error);
    10.         }
    11.         else {
    12.             var bundle = www.assetBundle;
    13.          
    14.             GameObject table = Instantiate(bundle.Load(modelName)) as GameObject;
    15.             table.transform.position = transform.position;
    16.         }

    1. As an extra question, is there a way to access the url I have in the asset bundle settings?
    For example is there a function to get something like DownloadManger.getBaseURL ?

    2. With LoadFromCacheOrDownload, I always have to provide a version number, is there a way to just load the newest version on the server if there is internet connection. But if no internet connection then load from cache?

    Thanks again!
     
    Last edited: Aug 26, 2014
  47. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Sorry for missing the post.
    But you are using Download Manager in a wrong way. You should always use WaitDownload or StartDownload of DownloadManager to get bundles instead using Unity native APIs.

    When you are using WaitDownload or StartDownload methods, the cache, CRC, version, url, priority and dependencies will be applied in background automatically. You don't need to care about them. All you need to do is make sure you set them up in the setting panel of BundleManager.

    When you try to use the Unity native APIs, you will lose all advantages mentioned above. Then Bundle Manager will be only a Bundle Builder for you.
     
  48. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    I will test again tmr(it's night for me here). But I remember my situation was like this:

    I use WaitDownloand and StartDownload the first time on my iPad. With Cache and CRC turned on. The bundle downloads.

    Then I test by turning off the wifi on the iPad. Terminate the app and open it again. The app does not load anything the second time because there is no internet connection.

    I will be back online in about 10 hours.

    Thanks for your reply, I will give you my test results as soon as possible.
     
  49. YinXiaozhou

    YinXiaozhou

    Joined:
    Oct 19, 2013
    Posts:
    133
    Sorry, DownloadManager cannot work without connection. DownloadManager always need to download initial datas which cannot be cached. Besides this way, DownloadManager can never know if any bundles are changed on server.
     
  50. argc_argv

    argc_argv

    Joined:
    Dec 14, 2013
    Posts:
    35
    So is there a way to make it so that if there is no internet connection, just load from cache?