1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Unity 5.6 is now released.
    Dismiss Notice
  6. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Asset Bundle Browser initial release

Discussion in 'Asset Bundles' started by unity_bill, Apr 11, 2017.

  1. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    5
    The first release of the Asset Bundle Browser is now available as an open-source editor extension here: https://github.com/Unity-Technologies/AssetBundles-Browser.
    It is still very early in its life, so we recommend backing up your project before using it. All feedback is welcome. For full documentation, see the included README, otherwise see the high level overview below.

    Overview
    This tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality.

    This tool is intended to replace the current workflow of selecting assets and setting their Asset Bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in Window->AssetBundle Browser. The bundle configuration and build functionality are split into two tabs within the new window.

    Configuration
    [​IMG]

    The configuration window shows you a list of all bundles in your project. You can select bundles to see their asset lists, and select assets to see their details. You can drag bundles and assets around within this utility to change bundle assignment, as well as drag assets in from the Project Explorer.

    Build
    The Build tab provides basic build functionality to get you started using asset bundles. In most profressional scenarios, users will end up needing a more advanced build setup. All are welcome to use the build code in this tool as a starting point for writing their own once this no longer meets their needs.


    Please reply to this post or add tickets to the github page with any questions, bugs, or feature requests.
     
  2. xuanyusong

    xuanyusong

    Joined:
    Apr 10, 2013
    Posts:
    45
    good!!!
     
  3. LingdongXin

    LingdongXin

    Joined:
    Aug 3, 2015
    Posts:
    2
  4. aoicocoon

    aoicocoon

    Joined:
    Feb 4, 2017
    Posts:
    1
    so good!!!
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    1,348
    I still don't understand why you guys are wasting time on these types of efforts; the node graph, this thing, it's all pointless.

    The problem you should be solving is not one of interface, but of design. There is no world in which I want to manually design and build bundles; carefully trying to avoid duplicating data, with any mistake meaning things get duplicated in memory. Can you name a use case where having a user download an asset more than once and duplicating it in memory is desirable? On any reasonably sized project, it's a nightmare to use this system without writing tons of code to automate the process.

    Simply slapping new interfaces on it every other month is doing nothing but eroding my belief that the problems of shipping a game with asset bundles are understood by Unity. You guys are polishing a flawed design.
     
    StaffanEk likes this.
  6. Reichert

    Reichert

    Unity Technologies

    Joined:
    Jun 20, 2014
    Posts:
    36
    Hi Jason,

    We are approaching this from two angles at the same time: 1) fix bugs and improve tooling and documentation around the existing build pipeline to relieve some user pain in the short term and 2) a complete overhaul of the build pipeline, editor workflows, and runtime resource management.

    The goal of the larger effort is that we address as many user scenarios as possible in a way that requires little to no code required from the user, while also improving the APIs to be more data oriented to minimize the amount of customization required when our built-in workflows are not sufficient.

    -Stephen
     
    Last edited: May 30, 2017
    Sniffy, LostPanda and mahdi_jeddi like this.
  7. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    2,546
    Hi @Reichert , is there any update on the progress you're making with asset bundles (the API, tooling, etc as you mentioned) ?

    Also, i submitted a PR against the "browser" repo. in case you guys want to check it out.
     
  8. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    1,933
    I like it, except if you have a lot of asset bundles, there doesn't appear to be a way to right click to create one (as the list gets long and there is no empty bundle space) so it just selects whatever bundle you right clicked on.

    Is the intent to organize the bundles into folders? Does putting these in folders change the structure of the asset bundle any or it it just a way to organize them?

    Thanks! It's a huge improvement over the old way of doing things as we have new bundles each month for different levels and the old way was a huge pain.
     
  9. Reichert

    Reichert

    Unity Technologies

    Joined:
    Jun 20, 2014
    Posts:
    36
    I'm working on a blog post to talk in more detail about our plans and progress.
     
  10. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    5
    Thanks for your input Brathnann. I'll get working on a way to add bundles even if the list is too long to have open space. That should definitely be in there. As to the folder question... the file structure on disk will mimic that in the browser. So if you created a bundle "FolderA/BundleB", you'd see a folder called "FolderA" on disk, and that folder would contain a bundle called "BundleB". I think in many cases, if you have large number of bundles in your game, it makes sense to use folders, but obviously there are situations where it does not. Independent of specific situations, the tool should work with whatever structure you choose to have.
    I've created an issue for you on the github projct here: https://github.com/Unity-Technologies/AssetBundles-Browser/issues/14
    Please subscribe to the issue so that once it's fixed I can let you know, and get feedback on the validity of the fix.
    Thanks,
    Bill
     
  11. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    5
    Thanks for the PR @liortal, I'll take a look at it.
     
  12. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    2,870
    Hi Bill, I recently posted Dependencies seem to be "Editor-based" and therefore misleading as issue on GitHub and this is related: Originally, I assumed that Unity's build-system / dependency checks would work in a way so that any assets that are included in the "main build" (i.e. all assets used by scenes included in the build settings and not included in assetbundles) are available to scenes / assets stored in AssetBundles. If that was the case, one could very easily add a few scenes to AssetBundles and rely on Unity to put the Assets exclusively used by those scenes into the relevant bundles (potentially duplicating assets that are used by multiple scenes in asset bundles that are not part of the "main build").

    Using the AssetBundleBrowser, however, it seems that this is not the case, and instead, you have to use an "all or nothing" approach when using AssetBundles: Any assets used by any scenes in the main build, that are also used by scenes or assets in AssetBundles will always be both in the main build and also added to the AssetBundles.

    So that means when you use AssetBundles, in most scenarios you'll be best off to just have one tiny "loader"-scene that uses almost no Assets and kind of bootstraps the game by loading the first AssetBundle(s) which has the first actual scene because that way, it's all in AssetBundles.

    Is that really the case? Or am I just confused due to limitations of the tools I am using (currently, I'm trying to figure things out using AssetBundle-Browser and AssetBundleEditor, but even though AssetBundleEditor gives me much better info on why an Asset is included in any given bundle, it still seems to rely on the dependencies from the editor-perspective, which may be misleading.

    It seems that once the AssetBundles are built, one could get the actually relevant information: Which Assets Are Included In An Asset Bundle? ... it seems like this would probably provide for a much better workflow if that information is somehow added to what AssetBundle-Browser (or AssetBundleEditor) shows.
     
  13. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    5
    Hi @jashan, It looks like you have two separate concerns to address.
    One is that you'd like to be able to view the contents of a bundle after it has been built. This is a feature that I am currently developing for the browser and hope to have out soon. Its definitely something that we know to be helpful and are making a priority to get out.
    The other item is what exactly happens when you mix and match including things in asset bundles and the standard player build. The short answer is that the two systems are completely unaware of each other, and the bundle browser is only aware of bundles. The player build will generally include the scenes explicitly added, those scenes' dependencies, and things in the Resources directory. If you also include assets in asset bundles, you do have potential duplicates due to shared dependencies. One solution is what you suggest; to only have a lightweight bootstrap scene in your player build and include everything else in bundles. It is not the only solution, and what you choose to do depends on your situation. For some the right solution would be to include the first handful of levels or tutorials in the built player, and have later levels in bundles on a content server. For others, it could be best to only reference prefabs by name in script, including those prefabs in bundles, but all other data with the player build. The key is to understand which items are getting built with your player.
    I hope this is helpful information, and you can find use in the browser. I will post to this forum once the browser supports a post-build-analysis of bundles.
     
  14. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    2,870
    That is great to hear!

    Do you have the information that those two systems are completely unaware of each other anywhere in the documentation? I believe that I have read most of the documentation about AssetBundles (including the tutorials and guidelines and "background information") at least one time, some parts several times ... and it only slowly dawned on me that this might be the case after running into some odd behaviors. The AssetBundleBrowser you're working on definitely helped realize this - but it's something I'd expect to read in the documentation. Actually, it probably should be one of the first things to read.

    This is really not obvious - especially because normal player builds are uncompressed, and AssetBundles are usually compressed. So when I started using AssetBundles, my build size did decrease, even though I had lots of asset duplication in the builds.

    Let me know what the best way is to let the documentation team know about this (if it's even an issue - but for me, it certainly was ;-) ).

    Ironically, there is a fairly large section about how to organize AssetBundles in the manual - but it does not address this fairly fundamental issue (or at least I didn't see it addressing that issue).


    Something else: It seems that another real minefield when using AssetBundles is shaders/materials. I noticed this when the terrain in some of our environments did not get effected by fog (there is also a related setting in the Player / Graphics settings, if I'm lucky this will fix this issue for me). One solution seems to be putting materials and shaders into the same AssetBundles so that the shader variants / keywords are properly handled. If that is the case, one nice feature for the AssetBundle browser would be to check materials / shader dependencies (i.e. give me a warning if I have the material without its shaders in a bundle). There may be even more to it (e.g. shaders used for image effects, or special purpose shaders may require some "special handling").
     
  15. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    5
    @jashan, I'll get your feedback on the documentation passed around so that it can be made more clear. I'll also investigate if there's anything the browser could do to help with shaders, but I'm not sure there is. A shader generally will be pulled in as a dependency of a material _but_ may not have the correct varaints. I don't think there's a good way for the browser to know what is wrong (if anything) in this situation. https://docs.unity3d.com/ScriptReference/ShaderVariantCollection.html might be something to look into.
    Thanks for all your feedback.
     
  16. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    2,870
    Ah, that does sound good - I'm already using ShaderVariantCollections extensively and actually started pulling in the Shaders using those collections. So if Unity AssetBundles behave well with ShaderVariantCollections, I'm covered ;-)

    Thanks for passing the documentation feedback around.
     
  17. Reichert

    Reichert

    Unity Technologies

    Joined:
    Jun 20, 2014
    Posts:
    36
    A ShaderVariantCollection will correctly influence how shaders are compiled by the Asset Bundle build pipeline when they are included in the same bundle as the target shaders.

    Our in-progress work to refactor the build pipeline will make this unnecessary as we will correctly calculate tag usage across shaders used in scenes and regular asset bundles. One exception to this will be any usage of Shader.Find from script.