Context is Unity, trying to start a new external process. Code looks like this:
var startinfo = new ProcessStartInfo {
FileName = RootPath + Executable,
WorkingDirectory = RootPath,
UseShellExecute = true,
WindowStyle = Visible ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden,
};
try {
_process = Process.Start(startinfo);
return true;
} catch (Exception ex) {
_global.Fail($"Unable to start engine {startinfo.FileName}.\n{ex.ToString()}");
return false;
}
This works just fine in the Editor, but Build&Run fails with the following error:
System.ComponentModel.Win32Exception (0x80004005): mono-io-layer-error (2)
at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) [0x00102] in <3df7f9ca50404bbc8bd4e7b954e70293>:0
at System.Diagnostics.Process.Start () [0x00032] in <3df7f9ca50404bbc8bd4e7b954e70293>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001b] in <3df7f9ca50404bbc8bd4e7b954e70293>:0
at ServerManager.StartServer () [0x00049] in <5143145dfb5b4093ac2347595a160b5c>:0
What does it mean? I can find nothing like it on the Web.
My guess is that the feature is perhaps not supported in the built version, but I have no way of finding out for sure or where to look for alternative approaches. At the end of the day all I really need is a way to launch an external process from a built Unity project.