close
using UnityEngine; // 注意 有使用這個的檔案,要放到 Assets/Editor 資料夾下,不然再進行 Build 會出錯 using UnityEditor; using System.Collections; public class ExExportAB { // 把功能加入上方列表Tools選項中產生一個 Export AssetBunldes選項 [MenuItem("Tools/Export AssetBunldes")] //Export AssetBunldes選項功能實作 static void ExportAssetBunldes () { // 定義要匯出路徑( Application.dataPath + 自訂) string Path = Application.dataPath + "/Export/"; // 定義要匯出檔案名稱和副檔名( 自訂 ) string ExpAssetBundleName = "test.assetbundle"; // 滑鼠選擇到的檔案 (可以用Ctrl or Shift 選擇多個檔案) Object[] SelectedAsset = Selection.GetFiltered (typeof(Object), SelectionMode.DeepAssets); // 只是印出剛剛選擇的檔案名稱,檢查用 foreach (Object obj in SelectedAsset) { Debug.Log ("Selecte File Name :" + obj.name); } // 產生AssetBunldes (Pro) // BuildAssetBundleOptions 哪一種方式產生 (不了解者,建議使用所有依賴關係) // BuildTarget 選擇你要產生哪一種的AB (Android, IPhone, Ios, Windowx64, windowx32 ...etc) if (BuildPipeline.BuildAssetBundle (null, SelectedAsset, Path + ExpAssetBundleName, BuildAssetBundleOptions.CollectDependencies, BuildTarget.Android)) { //更新編輯器 AssetDatabase.Refresh (); } } }
以下就是成功產生檔案的圖片
歡迎光臨 ~ Eg 程式筆記的天堂
當你看完此篇文章,如果你覺得文章不錯
可以留下鼓勵的留言~
將是我的撰寫更多相關文章的動力
文章標籤
全站熱搜