Search Unity

Manually defining which AssetBundles are included in a build

Discussion in 'Editor & General Support' started by HonoraryBob, Jul 21, 2017.

  1. HonoraryBob

    HonoraryBob

    Joined:
    May 26, 2011
    Posts:
    1,214
    I'm using a single project for several games (one scene for each game) to make things more manageable, so the usual method of putting all AssetBundles into the default directory won't work. Is there a way to manually define which assetbundles are included in a specific build?
     
  2. Dreamback

    Dreamback

    Joined:
    Jul 29, 2016
    Posts:
    220
    Do you mean assets, or asset bundles? If just assets, then Unity only includes the assets referenced in the scene, so if you are just building one scene, it will only get the necessary assets when you make a build with just that scene. Unless those assets are in a Resources folder, or StreamingAssets folder; those are included in all builds, because Unity doesn't know when you will need those assets.

    Asset Bundles are a specific thing in Unity, a way to export a collection of assets into a single file that you load as-needed.
     
  3. HonoraryBob

    HonoraryBob

    Joined:
    May 26, 2011
    Posts:
    1,214

    I was referring to asset bundles. I need to load stuff at runtime rather than just having a stock scene, so I'd need to include a different database for each game.
     
  4. Dreamback

    Dreamback

    Joined:
    Jul 29, 2016
    Posts:
    220
    Then I don't understand what you are asking? When you load an asset bundle, you pass in the name (and path/URL) of the bundle you want to load . So just don't load the bundles you don't want. The bundles shouldn't be included in the build at all, they are completely separate.
     
  5. HonoraryBob

    HonoraryBob

    Joined:
    May 26, 2011
    Posts:
    1,214
    So you just stick the file somewhere in the directory containing the executable file?