gpt4 book ai didi

c# - 在 Unity Cloud Build 中执行 bash 脚本

转载 作者:行者123 更新时间:2023-12-01 23:20:34 25 4
gpt4 key购买 nike

我的要求是在 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 player export failed!

! build of 'default_-android' failed. compile failed

Publishing build 22 of surbhijain87/roll-a-ball-game for target 'default_-android'...

publishing finished successfully.

done.

Build step 'Execute shell' marked build as failure

postbuildstatus finished successfully. Finished: FAILURE

最佳答案

太隐晦了。

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

在 mono 和 shell 脚本上运行的 UCB 看起来是正确的选择。

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

关于c# - 在 Unity Cloud Build 中执行 bash 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42481978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com