如何解决mono-io-layer-error (2) 是什么意思,在 Unity 中启动一个进程?
Context 是 Unity,试图启动一个新的外部进程。代码如下所示:
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;
}
这在编辑器中工作正常,但 Build&Run 失败并出现以下错误:
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
什么意思?我在网上找不到任何类似的东西。
我的猜测是构建版本可能不支持该功能,但我无法确定或在哪里寻找替代方法。归根结底,我真正需要的是一种从构建的 Unity 项目启动外部进程的方法。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。