- Home /
How do I get my build to work on the second launch?
Ok so I press build and run and my build works fine. Then I try launching it again from where I saved it and I run into a problem. I have an application called phantomjs that I put into my project folder and I have unity use this program using this code.
System.Diagnostics.Process.Start("phantomjs.exe",newD3Command);
And then the program creates a image and i load it into my project. Now this loading of phantomjs works fine when I build and run so I'm confused what is happening and what I can do to solve this problem. The error I'm getting from the build the second time I play it(or the first if I just do a build but not a build and run) is Win32Exception: the system cannot find the file specified.
Usually a window pops up for phantomjs to create the image but it does not happen so I think it is having trouble finding that application, but I'm not sure if that is right or how to fix it. Any ideas?
Answer by mdagreda · Feb 16, 2013 at 12:13 AM
Ok so I just changed my approach some but it was pretty easy to fix. Here is my new code.
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProcess.StartInfo.FileName = "C:\\Users\\NVD3_example_v2\\NVD3_example\\phantomjs.exe";
myProcess.StartInfo.Arguments = newD3Command;
myProcess.Start();