static void Build(string args = "") { InitArg(args); InitPlayerSetting(); BuildRes.BuildAll(); FileUtility.DeleteDirectory(PathManager.RES_STREAM_ROOT_PATH); FileUtility.CopyTo(PathManager.RES_LOCAL_ROOT_PATH + "/" + PathManager.GetEditorPlatform(), PathManager.RES_STREAM_ROOT_PATH + "/" + PathManager.GetEditorPlatform()); string[] level = GetBuildScene(); string outputPath = GetArg("output_path").Replace("\\", "/") + "/" + string.Format("{0:yyyy-MM-dd-HH-mm-ss-fff}", DateTime.Now); string name = "SLG"; string path = string.Format("{0}/{1}.exe", outputPath, name); BuildPipeline.BuildPlayer(level, path, BuildTarget.StandaloneWindows, BuildOptions.Development); FileUtility.ShowAndSelectFileInExplorer(outputPath); }
static void BuildIOS() { InitArg(); InitPlayerSetting(); BuildRes.BuildAll(); string[] level = GetBuildScene(); string outputPath = argDic["output_path"].Replace("\\", "/"); //生成唯一名字xcode工程,方便后面xcode自动化编译 if (Directory.Exists(outputPath)) { Directory.Delete(outputPath, true); } BuildPipeline.BuildPlayer(level, outputPath, BuildTarget.iOS, BuildOptions.None); }
static void Build(string args = "") { if (PathManager.GetEditorPlatform() != "Android") { Debug.LogError("当前不是Android平台,请切换后再打包!"); } else { InitArg(args); InitPlayerSetting(); BuildRes.BuildAll(); FileUtility.DeleteDirectory(PathManager.RES_STREAM_ROOT_PATH); FileUtility.CopyTo(PathManager.RES_LOCAL_ROOT_PATH + "/" + PathManager.GetEditorPlatform(), PathManager.RES_STREAM_ROOT_PATH + "/" + PathManager.GetEditorPlatform()); string[] level = GetBuildScene(); string outputPath = GetArg("output_path").Replace("\\", "/"); FileUtility.CreateDirectory(outputPath); string path = string.Format("{0}/{1}_{2}.apk", outputPath, "SLG", string.Format("{0:yyyy-MM-dd-HH-mm-ss-fff}", DateTime.Now)); BuildPipeline.BuildPlayer(level, path, BuildTarget.Android, BuildOptions.None); //使用5.6的unity path是不能含有Assets路径的,但是2017就可以使用包含有Assets的路径 FileUtility.ShowAndSelectFileInExplorer(path); Debug.Log("打包APK完成!"); } }