4

My requirement is to execute a bash script "PostProcessShellScript.sh" in PostProcessBuild. Unity build runs fine, but build fails in Unity Cloud Build.

Below is my code :

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 ()
}

Error details on 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

Sunil Sunny
  • 3,949
  • 4
  • 23
  • 53
Surbhi
  • 163
  • 2
  • 13

1 Answers1

0

too implicit.

I am using the shell scripting to resolve the issues.

UCB running on mono and shell scripting looks like the way to go.

Your resolution: convert the code to a shell script and attach on the UCB config from the UI

Rıfat Erdem Sahin
  • 1,738
  • 4
  • 29
  • 47