private void BuildApp() { const string fileName = "TSK"; #if UNITY_STANDALONE_WIN const string FolderName = "PC"; const string packName = fileName + ".exe"; #elif UNITY_STANDALONE_OSX const string FolderName = "MAC"; const string packName = fileName + ".app"; #elif UNITY_ANDROID const string FolderName = "AND"; const string packName = fileName + ".apk"; #elif UNITY_IOS const string FolderName = "IOS"; const string packName = fileName + ".ipa"; #endif #if RY_DEBUG const BuildOptions bo = BuildOptions.AllowDebugging | BuildOptions.ConnectWithProfiler; #else const BuildOptions bo = BuildOptions.None; #endif //var verInfo = VersionMgr.LoadAppVersion(); VersionMgr.SaveAppVersion(GitTools.getVerInfo()); AssetDatabase.Refresh(); //清空PC执行文件目录的缓存文件。 string ProductPath = Application.dataPath + "/../../Products"; string ProductPCPath = Path.Combine(ProductPath, FolderName); string BuildName = ProductPCPath + "/" + packName; if (!Directory.Exists(ProductPath)) { Directory.CreateDirectory(ProductPath); } if (!Directory.Exists(ProductPCPath)) { Directory.CreateDirectory(ProductPCPath); } //开始打游戏包 BuildPipeline.BuildPlayer(new string[] { "Assets/Scenes/ZERO.unity", }, BuildName, AssetPacker.buildTarget, bo); #if UNITY_STANDALONE AssetPacker.Log("Coping Essets ..."); SystemTools.CopyDirectory(Application.dataPath + "/../Essets", ProductPCPath + "/Essets"); #endif #if UNITY_IOS XCodePostProcess.OnPostProcessBuild(BuildName); #endif AssetPacker.Log("Build Done: " + BuildName); }
void OnGUI() { float fYLabor = 20.0f; GUI.Label(new Rect(0.0f, 0.0f, 400.0f, 36.0f), string.Format("Export Direction => [{0}]", ExportPath)); ExportPath = GUI.TextField(new Rect(80.0f, fYLabor, 240.0f, 44.0f), ExportPath); string showText = s_bExportType ? "Export" : "Process Proj"; Color old = GUI.backgroundColor; GUI.backgroundColor = Color.red; if (0 < ExportPath.Length && GUI.Button(new Rect(80.0f, fYLabor + 60.0f, 240.0f, 44.0f), showText)) { string pathVal = Application.dataPath.Replace('\\', '/'); int indexFind = pathVal.LastIndexOf('/'); pathVal = pathVal.Substring(0, indexFind + 1) + ExportPath; if (s_bExportType) { DMCore.Build.CBuildIOHelp.DeleteDirectory(pathVal); BuildToXCode(pathVal); } else { XCodePostProcess.OnPostProcessBuild(BuildTarget.iOS, pathVal); XCodePostProcess.s_projModePath = null; } CopyPlistAndAppController(pathVal, PluginsPath); CopyImageAssest(pathVal, PluginsPath); UnityEngine.Debug.Log("Build End!!!"); UnityEngine.Debug.Log("Build End!!!"); Close(); DMIosBuilder.s_Showed = false; } GUI.backgroundColor = old; }
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) { XCodePostProcess process = new XCodePostProcess(); process.DoPostProcessBuild(target, pathToBuiltProject); }