在Unity Cloud Build中执行BASH脚本



我的要求是在后处理build中执行bash脚本" postprocessshellscript.sh"。Unity Build运行良好,但构建在Unity Cloud Build中失败。

以下是我的代码:

public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) {
  .....
 string scriptPath = Application.dataPath + "/Plugins/Android/Editor/PostProcessShellScript.sh";
//Runs fine on Local Unity build
//RunInShell("C:\Program Files\bash.exe","/" + scriptPath + " " + " " + "/" + apkPath + "/"+ "/" + apkName, false);
 RunInShell("open","/" + scriptPath + " " + " " + "/" + apkPath + "/"+ "/" + apkName, false);
}
public static void RunInShell(string file, string args, bool waitForExit = true) {
    System.Diagnostics.Process ppScriptProcess = new System.Diagnostics.Process();
    ppScriptProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
    ppScriptProcess.StartInfo.FileName = file;
    ppScriptProcess.StartInfo.Arguments = args;
    ppScriptProcess.StartInfo.UseShellExecute = false;
    ppScriptProcess.StartInfo.CreateNoWindow = false;
    ppScriptProcess.StartInfo.RedirectStandardOutput = true;
    ppScriptProcess.StartInfo.RedirectStandardError = true;
    ppScriptProcess.Start ()
}

UCB上的错误详细信息:

!Unity Player导出失败!

!构建" Default_-android"失败。编译失败

出版surbhijain87/roll-a-ball-ball-game的版本22 'default_-android'...

发布成功完成。

完成。

构建步骤'执行shell'标记为失败

PostbuildStatus成功完成。完成:失败

太隐含了。

我正在使用 shell脚本解决问题。

在单声道和外壳脚本上运行的UCB看起来像是要走的路。

您的分辨率:将代码转换为shell脚本,然后从UI

附加在UCB配置上

最新更新