[C#] 纯文本查看 复制代码using System.Diagnostics;
using System.IO;
[MenuItem("Lua/BuildWithLuaC",false,200)]
public static void ProcessLuaWithLuaC()
{
string buildPath = Application.dataPath + "/Scripts/Editor/ToLuaTools/BuildWithLuaC.py" ;
//"@C:/Python27/python.exe"
RunPythonCmd( buildPath);
}
///
///
///
/// python
/// python file full path
private static void RunPythonCmd( string args)
{
ProcessStartInfo start = new ProcessStartInfo ();
start.FileName = "python";
start.Arguments = args;
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
using ( Process process = Process.Start(start))
{
using ( StreamReader reader = process.StandardOutput)
{
string result = "";
while (result != null)
{
result = reader.ReadLine();
UnityEngine. Debug.Log(result);
}
}
}
}