unity5 AssetBundleBuild用法

官方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);
    }
}

  官方代码就不拿出来吐槽了。。。

posted @ 2015-09-23 23:02  xiaojun1604  阅读(1195)  评论(0编辑  收藏  举报