Search Unity

Will AssetBundles do this?

Discussion in 'Asset Bundles' started by larku, Jul 30, 2017.

  1. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Objective: Use AssetBundles to include or exclude assets from builds.

    Background: Existing project that has multiple build types that require different assets. The single game scene contains all variants and I'd like to have a way for a build only to require the assets used for that build (some game objects will never be enabled in some variants and their assets need not be included in that build.

    Obviously there's better ways to do this (from a design point of view) but I'm here and this is what I'm solving :)

    What I'd like to be able to do is something like this (imaginary) sequence of steps.

    1. Mark each scene object with an AssetBundle tag and any assets they depend on/reference will be included in that asset bundle. This gives me a set of bundles something like "common", "arcade_version", "demo_version" etc.

    2. At build time (via build script or what not) choose which AssetBundles to include in this build, so one build may include "common" and "demo_version" assets but not "arcade_version" etc.
    So every object in my scene will have one of the asset bundle tags and will only be included in a build if that bundle is selected.

    I assume there is some way to include an asset bundle in the build. I'm not interested in remote loading etc. I want the build to be as much like it is now except with only the required resources included.

    Other considerations: What affect will this have on Sprite Atlases etc?

    I'm currently using Unity 5.6.2p2 with latest AssetBundle code downloaded from bitbucket.

    I noted some mention that 2017.1 may have some AssetBundle differences to 5.6. Is this the case? If so will 2017.1 assist with my goal?

    Any help appreciated.
     
  2. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    Hmm, if your assets are all in a scene, what I would probably suggest is using the IProcessScene callback and delete objects in the scene during this call based on what type of build you are doing. If you only do this during a build, it only will modify a temporary copy of the scene and not the original asset.
     
    larku likes this.