1.创建AssetBundlePacka脚本到Editor文件夹下
/*****************************************************
文件:AssetBundlePacka.cs
版本:01
作者:GZL
功能:AssetBundle打包工具
*****************************************************/
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
public class AssetBundlePacka
{
[MenuItem("AssetBundle/Package (Default)")]
private static void PackageBuddle()
{
Debug.Log("Packaging AssetBundle...");
string packagePath = UnityEditor.EditorUtility.OpenFolderPanel("Select Package Path",Application.streamingAssetsPath, "");
if (packagePath.Length <= 0 || !Directory.Exists(packagePath))
return;
Debug.Log("Output Path: " + packagePath);
BuildPipeline.BuildAssetBundles(packagePath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
AssetDatabase.Refresh();
}
}
2.选择你要打包的资源设置包名与后缀
3.选择AssetBundle/Package (Default)然后指定路径等待打包完成