Using Ironpython with Unity game engine.
We already know that we can use python to use .net internal calls.
Now we may use the same to start a console that can accept a scripting language in Unity engine.
To do this we have to include certain dll files.
These dll files must be present in Assets>plugins
- IronPython.dll
- IronPython.Modules.dll
- Microsoft.Scripting.Core.dll
- Microsoft.Scripting.dll
- Microsoft.Scripting.Debugging.dll
- Microsoft.Scripting.ExtensionAttribute.dll
- Microsoft.Dynamic.dll
Once the Plugins are in place.
Initiate the Cs code
PythonEngine engine = new PythonEngine(); engine.LoadAssembly(Assembly.GetAssembly(typeof(GameObject))); engine.ExecuteFile("Test.py");
Where test.py is the python code.
Initiate python side:
import UnityEngine from UnityEngine
import *
Debug.Log("Hello world from IronPython!")
More info coming soon!
References: