Search Unity

Improving Variants...

Discussion in 'Asset Bundles' started by audrey-unity, Jan 11, 2018.

  1. audrey-unity

    audrey-unity

    Joined:
    Jan 4, 2018
    Posts:
    11
    Hi I am Audrey, working in Austin with the Asset Bundle Build team. We are re-working Variants and would like to hear your Variant stories.
     
  2. nilsk123

    nilsk123

    Joined:
    Dec 13, 2016
    Posts:
    19
    This won't be very helpful, but for what it's worth. We use assetbundles for a wide variety of apps we have published in the App Store and Play Store, all in the field of AR. We have yet to find a usecase for us for asset bundle variants. The docs mention a need for variants to support different types of texture compression, but we have yet to come across an issue involving texture compression. Also, all phones we target handle the same content just fine.

    That being said, it's great to have the option, I'm sure theres more demanding use cases with more performance critical content demands. keep up the good work.
     
  3. audrey-unity

    audrey-unity

    Joined:
    Jan 4, 2018
    Posts:
    11
    These are the Common Variant use cases that projects might use:
    1) Localization
    2) Quality (HD/SD)
    3) Seasonal skins/theming

    How do you use Variants today? How would you like to use Variants?
     
  4. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    I don't use variants as they are. Never needed a different version of an asset. However, I'd love if Variants could control the different settings for an asset. Regarding texture compression, currently I need 'N' versions of my asset with compression settings set then assign each to a different variant.

    I'd love to have 1 single texture. And create different compression variants for that asset. Not as separate files, but on the asset itself. Then the bundle system builds these automatically for me. Of course, only variants for the same platform would be built.

    Currently I've got some scripts that I run before building bundles that go through all textures/sprites and based on some rules (must be compressed, must have alpha, must not be readable etc.) change the compression format. E.g ETC1 with split alpha.

    This is however a huge time sink, I have to re-import all those assets, build bundles then revert the changes, re-import all again. Switch to ETC2, apply settings, re-import, build, revert.

    It takes me 4 hours to build 4 bundles. (iOS, Android ETC2, Android ASTC, Android ETC1 with split alpha)
     
  5. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Most of the times I tries to use it for 3.Seasonal skins/theming.
    but unfortunate because I need different assets that maps to the same asset id! I want for example create entire UI with one set of sprites and then create second set that will be variant of first one and so every sprite in variant will have the same asset id so I can just load another bundle and have another look of my UI.
     
  6. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    What I really want is abbility to replace some asset in bundle with another asset of the same type so:

    I have master bundle that have main game assets or just placeholders.
    I load that bundle and if it contains actual assets instead of dummies assets I can already load it.
    Then I can load bundle override that can override some assets in first bundle so they will point to override bundle.
    Then all loads of assets that was overriden will result in assets from override bundle.

    Additional:
    - ability to load few override bundles over each other.
    - ability to have few assets from one source imported with different settings and passed to different bundles.

    With that system we can create any variations of bundles and assets with our own.
     
  7. audrey-unity

    audrey-unity

    Joined:
    Jan 4, 2018
    Posts:
    11
    Hi CDF, Thanks so much for the feedback. Good news, we are currently working on build configs which will allow you to have multiple configs for each Android platform and should help you with your situation. Hoping to have this out in late 2018.
     
    JotaRata and CDF like this.
  8. audrey-unity

    audrey-unity

    Joined:
    Jan 4, 2018
    Posts:
    11
    Hi Jes28 - Could you tell me a bit more about your project? At what level do you want to swap stuff out? A prefab? Texture in a prefab?
     
  9. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Hi,

    I want to swap stuff at level of any unity asset i.e. Texture, Sprite, myCustomScriptableObject, Mesh, Prefab, Animation, AniumatorController...

    So when I want to create Variant of my assets I can! e.g. want to change skin of UI and used particles for event or Christmas - just provide bundle with variant sprites and effect prefabs, want to replace mobs in game to more hi end and detailed look for hi end devices - just provide variant bundle with hi end mob prefabs, want to replace game settings - just provide variant bundle with retuned Config.asset, want to have few styles of models in game - just load variant bundle with models of style you want.

    to all this work we need ony one thing. Ability to have same ids for corresponding assets in different bundles.

    work style would be:
    1.load all bundles with assets master bundle (i.e. GameUI) depends on
    2.load master bundle (i.e. GameUI) and see one ui style
    3.unload master bundle
    4.unload bundles with ui assets
    5.load bundles with different ui assets (sprites, meshes, effects, prefabs...)
    6.load master bundle (i.e. GameUI) and see another ui style
     
  10. audrey-unity

    audrey-unity

    Joined:
    Jan 4, 2018
    Posts:
    11
    Hi Jes28, Thanks so much for the deets! We are working on your use cases and really appreciate your detailed feedback!
     
    Last edited: Feb 8, 2018
  11. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    Hi Asset Bundle team..

    What we'd like to do with variants is the following:

    1. Be able to turn a folder containing the same type of asset into a variant collection by adding a "variant" asset in the folder. A naming convention for files such as filename@tag.fbx is used to auto-populate the variant tags which are used to switch between variants. Example: mytexture@lores.png mytexture@hires.png or mylanguage@en-us.txt mylanguage@zh-cn.txt.

    2. The Variant asset itself is then is treated in Unity as an asset of that type (texture, prefab, etc), and can be added to scenes and treated as a normal asset. The variant asset has the icon for the asset it represents, plus a small V corner icon to indicate it is a variant.

    3. A "Variants" window from the Window menu which shows the current variant groups and variant tags in the project, which allows you to activate/switch which tags are currently active. Switching active tags will cause the current Editor scene to reload and use the variant assets selected.

    4. A C# API for setting the variant tags for the Resource system and asset bundle loading. Setting the appropriate tags will cause the resource system to automatically load the correct variants.
     
  12. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    Note that in this scenario, Variants are decoupled from asset bundles.

    Variants would work for assets included in Resources folders as well as with asset bundles.

    Since the variant is an asset itself, it could be bundled in the primary "general" asset bundle, and then the individual variant assets (textures, meshes, prefabs) would be grouped and bundled in a separate dependency bundle (or bundles) with all of the assets of that tag type.

    The asset bundle system could then trace those dependencies and auto-load the correct dependent bundles based on which variant tags were activaged in the C# api.
     
    JesOb likes this.
  13. audrey-unity

    audrey-unity

    Joined:
    Jan 4, 2018
    Posts:
    11
    Hi benjcooley - Thank you so much for the feedback! Nice design with a friendlier interface == good stuff!
     
    Last edited: Feb 9, 2018
  14. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    Thanks!

    Also - for asset imports:

    - For assets, or at least certain types of assets, you could set multiple compression settings, each tagged with a separate variant tag.

    - At the top of the 'compression' rollouts for textures, meshes, and other assets, you would have a drop down displaying the set of variants, and buttons to add/remove variants.

    - Different compression settings could be set for each variant. Different max texture sizes, or compression format, or key compression for animations, or mesh compression for meshes.
     
    JesOb likes this.
  15. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    BTW, just wanted to add, this is not academic for us.

    We use "poor mans" variants to implement our content. Basically lots of shell scripts which rename asset and meta files to add or remove periods (".") in front of files to enable/disable them.

    I'm fairly certain that most other game studios have similar systems involving symlinked folders, moving files around, or using the period trick.

    Would be nice to see an integrated variant system which would ameliorate this issue.
     
  16. audrey-unity

    audrey-unity

    Joined:
    Jan 4, 2018
    Posts:
    11
    Hi benjcooley - Thank you again for the thoughtful feedback. You are correct that some studios are using shell scripts to work with variants. We totally agree, we'd like to create a integrated variant system that is easy for our users. :)
     
  17. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    Can you elaborate on this? Will this build config be per asset? We will have to start supporting various texture formats for each texture on webgl (much like android) and right now the variant system is a poor solution to this problem (having to keep multiple copies of the same texture in sync is often error prone).

    Secondly, will this build config system work with variants? The current variant system works well for "DLC" (i.e. when you have a 1:1 replacement for the original asset). However we have "DLC textures" that also need to be built for each different texture format. So ideally we could still keep the current variant system for "DLC" and then combine that with a system that automatically generates a copy (asset bundle) for every texture format.

    TLDR: current variant system is good for when you want actual changes within the asset file itself, not good when you just want to change import settings
     
  18. k76

    k76

    Joined:
    Oct 12, 2014
    Posts:
    12
    I know this thread is old, but I'm looking for a solution that will allow multiple texture import settings for the same platform. For example: Standalone Windows SD and Standalone Windows HD. This will allow me to swap out asset bundles based on player options to go for better performance or quality, respectively, while having a single asset source file for both. Has any progress been made on these build configs?
     
    kainoo and mkg2w like this.