Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

BuildPipeline.BuildAssetBundles doesn't include all assets.

Discussion in 'Asset Bundles' started by trackOfer, Jan 17, 2019.

  1. trackOfer

    trackOfer

    Joined:
    Dec 27, 2017
    Posts:
    9
    I wrote a small editor script that is suppose to include about 400 files inside the asset bundle.
    Eventually it only include 20 DDS files out of the 400, 200 of those files are my own custom format.
    Are asset bundles limited somehow with the size and formats it support?
    I don't understand why the code builds an AB with only 20 or so files.

    Code (CSharp):
    1. [MenuItem("Assets/Build AssetBundle")]
    2.     static void ExportResource()
    3.     {
    4.         string path = "Assets/myAssetBundle.unity3d";
    5.  
    6.         AssetBundleBuild[] buildMap = new AssetBundleBuild[1];
    7.  
    8.         buildMap[0].assetBundleName = "Boxers";      
    9.         string[] enemyAssets = new string[197*2];
    10.         for (int i=0; i<197; i++)
    11.             enemyAssets[i] = "Assets/Boxers/meshWithTexture"+(i+1)+".trs";
    12.         for (int i = 0; i < 197; i++)
    13.             enemyAssets[i+197] = "Assets/Boxers/meshWithTexture" + (i + 1) + ".dds";
    14.         buildMap[0].assetNames = enemyAssets;
    15.  
    16.         BuildPipeline.BuildAssetBundles("Assets/ABS", buildMap, BuildAssetBundleOptions.None, BuildTarget.WebGL);
    17.     }
     
  2. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    3,350
    I believe asset bundles must not exceed 4GB in size, just like resources. Unfortunately, I didn't find any official documentation regarding any asset bundle filesize limit.
     
    alpha_rat likes this.
  3. trackOfer

    trackOfer

    Joined:
    Dec 27, 2017
    Posts:
    9
    It didn't exceed 4 GB though. every DDS file is about 2.5 MB and I have only 200 of those. The TRS are only 600KB and also only 200 of those