官方AssetBundleBuild列子有引导错误,主要是AssetsName,其实是表示Asset的路径。
下面是测试过代码:
using UnityEngine; using System.Collections; using UnityEditor; public class BuildAsset : MonoBehaviour { [MenuItem("Assetbundle/Create")] public static void AssetbundleCreate() { AssetBundleBuild[] mapbuild = new AssetBundleBuild[1]; mapbuild[0].assetBundleName = "new.u"; string[] assets = new string[1]; assets[0] = "Assets/cube.prefab"; mapbuild[0].assetNames = assets; BuildPipeline.BuildAssetBundles("Assets/abs", mapbuild); } }
官方代码就不拿出来吐槽了。。。
时间: 2024-11-10 15:45:50