The Python for Unity package adds an API (code library) that we can access through our C# code, as well as the Python Script Editor window for testing and running simple Python statements. We tested Python Script Editor with a traditional Hello World print statement.
Our C# script class, called HelloConsole.cs , demonstrated how we can use the PythonRunner.RunString($...) method in our C# scripts to execute a string containing Python code. Note that we must add a using statement to import the UnityEditor.Scripting.Python library for this work.
In both our scripts, we used the [MenuItem("<menu/item>")] Editor instruction to enable us to easily test out code from a menu item.
Our Invoke.cs C# script class demonstrated how we can use the PythonRunner.RunFile($...) method in our C# scripts to execute a text file containing Python code. We created a file called renamer.py containing pure Python...