The easiest way to start using Python for Unity is with the Python Script Editor:
You can type Python statements in the bottom window. Click on the Executebutton or type Ctrl-Return (Cmd-Return on macOS) to run the selected text.
Python print statements will appear in the upper window as well as in the Editor.log.
A Unity asset extractor for Python based on AssetStudio. Next to extraction it also supports editing Unity assets. So far following obj types can be edited: Texture2D; Sprite(indirectly via linked Texture2D) TextAsset; MonoBehaviour; If you need advice or if you want to talk about (game) data-mining, feel free to join the UnityPy Discord. Use Python with Unity First you will have to download IronPython dll files and place them into Assets/Plugins directory. The easiest way to do this is by downloading my Unity package. Import my Unity package to your game project. Make 34 Games in Unity® & Code for Android Development; Start to Finish Unity Games and Python Coding; Master Unity and Blender: Make 40 Games and Low Poly Art; We cover basic programming concepts for people who have never programmed before. This course covers key topics in Python and coding in general, including variables, loops, and classes.
The load and save buttons allow reusing scripts.
Save & Create Shortcut adds a menu item to run the current script.

It does this by creating two files side by side: a C# file to create the menuitem, and a Python file which is a copy of your script in the Python Script Editor.The menu item name needs to be unique. You will see an error in the Unity console ifyou use an existing menu item name, and you will need to fix the C# file and modifyits [MenuItem].
Advanced Tool Programming
To implement more complex Python-based tools in Unity, there are two relevant APIs:
- The in-process API allows you to invoke Python code fromC# that runs in the Unity process.
- The out-of-process API allows you to connect to anexternal application, e.g. a custom tool implemented in PySide.
Limitations
Unity Python 2019
Undo/redo is not implemented. Save often.

Sometimes, print statements stop printing in the Script Editor output. The workaround is to restart Unity.
Run Python In Unity
Python is a great programming language due to a multitude of reasons such as a long list of libraries ready to solve almost any problem you might encounter. For me, however, the biggest reason to prefer coding in Python with Unity over C# is that I simply don't have to type as much; no type declarations, semicolons or curly brackets, not to mention return types, scopes and so on… 😴
Unity Vs Python
Yet, online I can only find outdated guides or worse yet 'why don't you just learn C#, it's easy and blah blah' comments. 😫 But I like Python. 🥺Therefore, this post teaches you how to use IronPython with Unity. Just remember that IronPython only supports Python 2.
Use Python with Unity
First you will have to download IronPython dll files and place them into Assets/Plugins directory. The easiest way to do this is by downloading my Unity package.
Import my Unity package to your game project
IronPython requires .NET 4.5, and Unity doesn't like this by default. That's why you will have to change the .NET version by going to Edit -> Project Settings -> Player. Make sure that the Scripting Runtime Version is .NET 4.x (this requires you to restart Unity) and that API Compatibility level is .NET 4.x
How to code in Python
Unity Python Scripting

Assume you have a small code snippet greeter.py in Python like this:

You can use it from C# like this
For a similar example, see the PythonExample prefab in my Unity package.
As you can see, the Python class can be directly used as an object in C#, and better yet, if you provide the path to the AssetsPluginsLib folder included in my Unity package, you can use anything in Python standard library! In addition, if you also provide the path to your Python script, you can import anything in that path as usual.
Next steps

If you want to use any external Python libraries (the ones you install with pip), you can just download and extract them to the
AssetsPluginsLib folder. This will make them available for IronPython.
Note: Using absolute paths is fine when you are doing development, but if you ever decide to publish your game, you will need to resolve the paths dynamically and distribute the standard library in AssetsPluginsLib and your Python scripts with the game executable.
Unity Python Support
Finally you can have the best of two worlds: Unity's dead easy world editor and Pythonic simplicity. ☺️




