Ich versuche IronPython als eine externe Skriptsprache für Unity3D zu verwenden. Die notwendigen DLLs für die Ausführung von IronPython laden sich gut in Assets \ Plugins. Aber wenn ich versuche, um das Skript auszuführen bekomme ich diesen Fehler:IronPython in Unity3D
PythonImportErrorException: No module named UnityEngine
IronPython.Modules.Builtin.__import__ (IronPython.Runtime.Calls.ICallerContext,string,object,object,object) <IL 0x0003b, 0x001cc>
(wrapper dynamic-method) object.__import__##5 (IronPython.Runtime.Calls.ICallerContext,object,object,object,object) <IL 0x0000e, 0x0004d>
IronPython.Runtime.Calls.FastCallableWithContextAny.Call (IronPython.Runtime.Calls.ICallerContext,object,object,object,object) <IL 0x00015, 0x00067>
IronPython.Runtime.Calls.BuiltinFunction.Call (IronPython.Runtime.Calls.ICallerContext,object,object,object,object) <IL 0x0000d, 0x00058>
IronPython.Runtime.Operations.Ops.CallWithContext (IronPython.Runtime.Calls.ICallerContext,object,object,object,object,object) <IL 0x00012, 0x000b0>
IronPython.Runtime.Importer.Import (IronPython.Runtime.PythonModule,string,IronPython.Runtime.List) <IL 0x0000d, 0x0006c>
IronPython.Runtime.Operations.Ops.Import (IronPython.Runtime.PythonModule,string) <IL 0x00007, 0x0003b>
(wrapper dynamic-method) object.<string>##1 (IronPython.Runtime.ModuleScope) <IL 0x0006b, 0x00210>
Das Skript und die ‚UnityEngine.dll‘ sind im selben Ordner befindet. Dies ist das Skript:
import clr
clr.LoadAssemblyFromFile("UnityEngine.dll")
import UnityEngine
from UnityEngine import *
Debug.Log("Hello World from Python!")
Aus Interesse: warum Ironpython? –
Es ermöglicht mir, mit Unity3D zu arbeiten, die auf Mono.NET aufgebaut ist –
Unity3d unterstützt Boo aus der Box, die ziemlich nah an Python ist; Ich frage mich, warum du gerade IronPython drin hast. –