Esempio n. 1
0
    private static void Create()
    {
        string outPath = Path.Combine(AssetBundlesOutputPath, EditorUserBuildSettings.activeBuildTarget.ToString());

        if (!Directory.Exists(outPath))
        {
            Directory.CreateDirectory(outPath);
        }
        LoaderManager.CleaarAllABNames();
        LoaderManager.SetABNames(sourcePath);

        //根据BuildSetting里面所激活的平台进行打包
        AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(outPath, BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);

        AssetDatabase.Refresh();
        EditorUtility.DisplayDialog("", "打包" + (manifest == null ? "失败" : "成功"), "确定");
    }