Visitar URL original
GitHub - exodrifter/unity-python at 0.3.0 · GitHub
Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
exodrifterPublic archive

About

Python plugin for Unity3D.

Topics

Resources

Stars

354 stars

Watchers

43 watching

Forks

Repository files navigation

UnityPython

UnityPython is a plugin for Unity3D that provides support for running Python code in Unity.

Special thanks to the developers of IronPython who developed the open-source integration of Python and .NET, which this plugin uses.

Setup

Place the source of this project anywhere in the "Assets" folder. For convenience, you can use the latest .unitypackage release from the releases page to do this.

Then, go to Edit > Project Settings > Player > Other Settings > Configuration and change Scripting Runtime Version to "Experimental (.NET 4.6 Equivalent)".

Usage

An example is provided below. More examples can be found in the Examples/ folder.

using UnityEngine;
using IronPython.Hosting;

public class HelloWorld : MonoBehaviour
{
	void Start()
	{
		var engine = Python.CreateEngine();
		var scope = engine.CreateScope();

		string code = "str = 'Hello world!'";

		var source = engine.CreateScriptSourceFromString(code);
		source.Execute(scope);

		Debug.Log(scope.GetVariable<string>("str"));
	}
}

About

Python plugin for Unity3D.

Topics

Resources

Stars

354 stars

Watchers

43 watching

Forks

Releases

Packages

Used by

Contributors

Languages