鍍金池/ 問(wèn)答/Python  Unity 3D/ 在Unity中調(diào)用Python

在Unity中調(diào)用Python

如題:我想知道在Unity里面怎么調(diào)用Python,怎么和Python的數(shù)據(jù)互通,我在C#的控制臺(tái)程序中可以進(jìn)行數(shù)據(jù)互通,
但是在Unity里面互通失敗,,,,,求解 求方法。。謝謝

回答
編輯回答
毀與悔

或許你可以考慮用ProcessStartInfo來(lái)實(shí)現(xiàn)。

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);
            }

        }
    }
}
2018年9月7日 05:08