最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Unity AssetBundles doesn't include all assets - Stack Overflow

programmeradmin3浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论