public static void GoExport(string _path, UnityEditor.AssetBundleBuild[] _builds, BuildTarget _target) { if (!Directory.Exists(_path)) { Directory.CreateDirectory(_path); } if (_builds.Length == 0) { return; } BuildPipeline.BuildAssetBundles(_path, _builds, sBuildOption[ExportSetting.Instance.sCompressed] | BuildAssetBundleOptions.DeterministicAssetBundle, _target); string tmanifestname = ExportConfig.GetTartFolder(_target).Replace("/", ""); string tdespathname = _path + "/" + "AppManifest" + sSuffixName; if (File.Exists(tdespathname)) { File.Delete(tdespathname); } File.Copy(_path + tmanifestname, tdespathname); BuildByteFileInfoFile(_path, _path, _target); AssetDatabase.Refresh(); Debug.Log("导出完成!"); }
static public void MoveBundleToSideDate(BuildTarget _target) { Config.LoadConfig(); string tpath = GetExportPath(_target); string tfullpath = System.IO.Directory.GetCurrentDirectory() + "\\" + Config.sEditorBundleFolder + ExportConfig.sResDataPath; tfullpath = tfullpath.Replace("\\", "/"); MoveToPath(tpath, tfullpath, ExportConfig.GetTartFolder(_target)); }
static public void MoveBUndleToStreamingPath(BuildTarget _target) { Config.LoadConfig(); string tpath = GetExportPath(_target); string tfullpath = System.IO.Directory.GetCurrentDirectory() + "\\" + Config.sStreamingBundleFolder + ExportConfig.sResDataPath; tfullpath = tfullpath.Replace("\\", "/"); MoveToPath(tpath, tfullpath, ExportConfig.GetTartFolder(_target)); AssetDatabase.Refresh(); }
override public void OnGUI() { GUILayout.Label("Platform", EditorStyles.boldLabel); int oldSelectedPlatm = ExportSetting.Instance.sSelectedPlatm; int oldcompressed = ExportSetting.Instance.sCompressed; int oldsBuildType = ExportSetting.Instance.sBuildType; ExportSetting.Instance.sSelectedPlatm = GUILayout.SelectionGrid(ExportSetting.Instance.sSelectedPlatm, sPlatformList, 3); ExportSetting.Instance.sCompressed = GUILayout.SelectionGrid(ExportSetting.Instance.sCompressed, sCompressed, 2); ExportSetting.Instance.sBuildType = GUILayout.SelectionGrid(ExportSetting.Instance.sBuildType, sBuildType, 4); //ExportSetting.Instance.sPathType = GUILayout.SelectionGrid(ExportSetting.Instance.sPathType, sPathType, 2); if (oldSelectedPlatm != ExportSetting.Instance.sSelectedPlatm || oldcompressed != ExportSetting.Instance.sCompressed || oldsBuildType != ExportSetting.Instance.sBuildType) { NeedSaveSetting(); } Config.OnGUI(); if (GUILayout.Button("Export Assets")) { ExportAllBundleFullPath(sBuildTarget[ExportSetting.Instance.sSelectedPlatm]); } if (GUILayout.Button("Creat Infos")) { var ttar = sBuildTarget[ExportSetting.Instance.sSelectedPlatm]; string tpath = GetExportPath(ttar); BuildByteFileInfoFile(tpath, tpath, ttar); AssetDatabase.Refresh(); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Move Assets to SidePath")) { MoveBundleToSideDate(sBuildTarget[ExportSetting.Instance.sSelectedPlatm]); } if (GUILayout.Button("Move Assets to StreamPath")) { MoveBUndleToStreamingPath(sBuildTarget[ExportSetting.Instance.sSelectedPlatm]); } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Move to")) { string toldpath = ExportSetting.Instance.sMoveAssetsFilePath; toldpath = EditorUtility.OpenFolderPanel("Move to path", toldpath, ""); if (!string.IsNullOrEmpty(toldpath) && !toldpath.Equals(ExportSetting.Instance.sMoveAssetsFilePath)) { ExportSetting.Instance.sMoveAssetsFilePath = toldpath; NeedSaveSetting(); } if (string.IsNullOrEmpty(ExportSetting.Instance.sMoveAssetsFilePath)) { return; } Config.LoadConfig(); BuildTarget _target = sBuildTarget[ExportSetting.Instance.sSelectedPlatm]; string tpath = GetExportPath(_target); MoveToPath(tpath, ExportSetting.Instance.sMoveAssetsFilePath, ExportConfig.GetTartFolder(_target)); } }
static public string GetExportPath(BuildTarget target) { return(Config.sDefaultFolder + ExportConfig.GetTartFolder(target)); }