- Home /
Running bash script in Post-Export method
I want to execute a bash script in OnPostProcessBuild() method , but my Unity Cloud build fails with below error logs :
! Unity player export failed! ! build of 'default_-android' failed. compile failed Publishing build 22 of .... for target 'default_-android'... publishing finished successfully. done. Build step 'Execute shell' marked build as failure postbuildstatus finished successfully. Finished: FAILURE
My Code is as below :
public class MyBuildPostprocessor : MonoBehaviour {
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) {
String[] pathArr = pathToBuiltProject.Split ('/');
String apkName = pathArr [pathArr.Length - 1];
String apkPath = pathToBuiltProject.TrimEnd (apkName.ToCharArray());
string scriptPath = Application.dataPath + "\\Plugins\\Android\\Editor\\PostProcessShellScript.sh\"";
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.Start();}}
Answer by squarelover · Feb 08, 2021 at 09:15 AM
have same question no answers no examples short documentation hazy
Your answer
Follow this Question
Related Questions
Cloud recognition in Vuforia 0 Answers
Unity Cloud Build Summary Reports are useless 0 Answers
Problems with Cloud build 0 Answers
Unity Cloud Build + Firebase 5.6.1 0 Answers
Unity Cloud Build "Post-Build Script configured, but not found" 0 Answers