#
Welcome to PocketPython
PocketPython is a C# plugin that allows you to do Python scripting in Unity. It provides a sandboxed Python environment, which adds dynamic capabilities to your game, which can be used for dynamic game logic, modding, hot fixing, and more.
The virtual machine is written in pure C#, which means you can fully control the internal state of the Python interpreter.
PocketPython is designed for game scripting, not for scientific computing. You cannot use it to run NumPy, OpenCV, or any other CPython extension modules.
#
Features
#
Python 3.x Syntax
PocketPython uses pocketpy as frontend to parse and compile Python source code. It supports most of the Python 3.x syntax.
The following table shows a feature comparison of PocketPython
with respect to the original pocketpy.
The features marked with YES
are supported, and the features marked with NO
are not supported.
#
Sandboxed Python Environment
PocketPython provides a sandboxed Python environment. All python code is executed in a C# virtual machine. The user cannot access the file system, network, or any other resources of the host machine.
#
Seemless Interop with C#
PocketPython uses object
in C# to represent dynamic typed Python objects.
Most of the basic Python types correspond to a C# type,
which means passing arguments between C# and Python is extremely easy and intuitive.
#
Python Console in Editor
PocketPython provides a Python console in Unity editor, which allows you to do quick debugging and testing.