Search Unity

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:
    10
    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

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    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:
    10
    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
     
  4. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Anybody knows how i can see the log after it does an assetbundle build, so i can see the size of each resource that was included in the assetbundle build?
     
  5. munkbusiness

    munkbusiness

    Joined:
    Aug 22, 2017
    Posts:
    55
    You add -logFile nameoglogfile.log to your build command. The log file is placed in the root of your project folder.

    Example:
    Code (CSharp):
    1. "C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -projectPath "C:\Users\username\Documents\Unity projects\theProjectName\"  -logFile stdout.log -executeMethod Builder.Build