zoukankan      html  css  js  c++  java
  • Unity中使用Process注意事项

      在unity中,要调用外部程序处理时,常见代码如下:

    Process proc = Process.Start(new ProcessStartInfo
    {
    FileName = LuacToolPath,
    Arguments = " -o " + newPath + " " + luaPath,
    UseShellExecute = false,
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    CreateNoWindow = true
    });
    if (proc != null)
    {
    proc.WaitForExit();
    string stdOutput = proc.StandardOutput.ReadToEnd();
    if (stdOutput.Length > 0)
    UnityEngine.Debug.LogError(stdOutput);
    string errOutput = proc.StandardError.ReadToEnd();
    if (errOutput.Length > 0)
    UnityEngine.Debug.LogError(errOutput);
    }

    此处需要注意的是:如仅重定向error输出,可能导致unity假死(如luac编译文件报错)。加上output定向后一切正常。。。

  • 相关阅读:
    [luoguP2622] 关灯问题II(状压最短路)
    [luoguP2016] 战略游戏(DP)
    FileUpload
    Mysql -- JDBC
    Mysql优化
    Mysql锁
    Mysql索引
    Mysql事务
    Mysql基本语句
    Listener
  • 原文地址:https://www.cnblogs.com/hghhe/p/14449091.html
Copyright © 2011-2022 走看看