Running shell scripts Mac: POST BUILD
Hello, I have recently been working on a small Unity project. I have got everything working in the editor, however what seems not to be working is when I have built my app and any process that requires this code doesn't work, I am not too sure why. Any fixes?
void Start () {
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Application.dataPath+"/MyShell.command";
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.Arguments = "";
//All Arguments get passed but be careful, return data back in one ECHO!!!!!
//psi.Arguments = "test";
Process p = Process.Start(psi);
string strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
UnityEngine.Debug.Log(strOutput);
}
This is what I have in my Player.log: https://pastebin.com/Q2LUrqfY
Have you already checked that the file you want is in the location you specified?
Note that Application.dataPath returns a different path depending on the platform, which could cause the file to be found in Editor but not on builds.
Just to rule it out, is the file you want in this location:
'/Users/leonps/Desktop/cApp.app/Contents/CheckInPlace.command'?
Your answer
Follow this Question
Related Questions
BUİLD ERROR!! it just fails on this project,BUILD ERROR!!! it just fails on this project 0 Answers
Can't "build and run". Can only use the "build "option 0 Answers
I can't build my project WebGL,i can't build my project as webgl 0 Answers
Mac os unity iOS build Pink Screen Error 7 Answers
WebGL Build Button still greyed out.,I'm not able to build WebGl version. 0 Answers