I'm having trouble with AssetBundles in Unity. I have configured an AssetBundle and it shows all the assets correctly in the AssetBundle Browser, but when I generate the AssetBundle using a script, it only includes a small portion of the assets (23MB instead of the expected 0,97GB).
Configure AssetBundle:
I have configured an AssetBundle in Unity and assigned it to a prefab. In the AssetBundle Browser, all assets are listed correctly, but most of them show "Dependent on: - None".
Generate AssetBundle:
I use the following script to generate the AssetBundle:
using UnityEditor;
using UnityEngine;
using System.IO;
public class BuildAssetBundles
{
[MenuItem("ACE/Build AssetBundles")]
static void BuildAllAssetBundles()
{
string assetBundleDirectory = "Assets/AssetBundles";
if (!Directory.Exists(assetBundleDirectory))
{
Directory.CreateDirectory(assetBundleDirectory);
}
BuildAssetBundleOptions options = BuildAssetBundleOptions.ForceRebuildAssetBundle;
BuildPipeline.BuildAssetBundles(assetBundleDirectory, options, BuildTarget.Android);
Debug.Log("AssetBundles generated in: " + assetBundleDirectory);
}
}
Issue: The generated AssetBundle is only 23MB instead of the expected 0,93GB.
Expected Behavior: The generated AssetBundle should include all the configured assets and be around 173MB in size.
Actual Behavior: The generated AssetBundle is only 23MB.
Additional Information: Unity Version: Unity 2022.3.30f1 Platform: Dev on MacOs for Android assetbundle AssetBundle Configuration: All assets are correctly assigned to the AssetBundle in the AssetBundle Browser.
Question: How can I ensure that all configured assets are included in the generated AssetBundle?