【问题标题】:Execute a bash script in Unity Cloud Build在 Unity Cloud Build 中执行 bash 脚本
【发布时间】:2017-07-17 20:14:56
【问题描述】:

我的要求是在 PostProcessBuild 中执行一个 bash 脚本“PostProcessShellScript.sh”。 Unity 构建运行良好,但在 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 播放器导出失败!

! 'default_-android' 的构建失败。编译失败

为目标发布 surbhijain87/roll-a-ball-game 的 build 22 'default_-android'...

发布成功完成。

完成。

构建步骤 'Execute shell' 将构建标记为失败

postbuildstatus 成功完成。完成:失败

【问题讨论】:

  • 你解决了吗?

标签: c# android bash unity3d unity3d-cloud-build


【解决方案1】:

太含蓄了。

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

在单声道和 shell 脚本上运行的 UCB 看起来不错。

您的解决方案:将代码转换为 shell 脚本并从 UI 附加到 UCB 配置上

【讨论】:

    猜你喜欢
    • 2019-10-06
    • 1970-01-01
    • 2013-07-13
    • 1970-01-01
    • 2017-03-08
    • 2012-06-24
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多