You can get a pretty nice setup going for python with autocomplete for unity_python. I was going to use the WSL system integration so I could more easily use PySide2 along with python2.7, but then Unity would only detect and use python.exe and won’t work with python via WSL that I could figure out so far, though I only tried for a few moments by pointing it to the wsl uri (\wsl$\Ubuntu18.04\usr\lib\python, though I didn’t try wsl://UBUNTU1804/. Perhaps I will try later).
Going to settings, then in the top right corner is a button to switch to json editing, you can add the following code after having installed the Python extension for VSCode, assuming you installed pything2.7 in the default location of C:\python2.7.
I am not 100% sure the line python.autoComplete.preloadModules still works, but I already had it in there for working with Houdini. Normally I would configure it to use a python interpreter and path for WSL so I can have more and better access to packages, but since Unity only uses python.exe for Windows, it would not help much as there isn’t the same availability of packages and might end up being discrepancies.
"python.autoComplete.extraPaths": [ "C:\\path\\to\\your\\project\\Library\\PackageCache\\com.unity.scripting.python@2.0.0-preview.6\\Python\\site-packages"],
"python.autoComplete.preloadModules": [ "unity_python"],
"terminal.integrated.env.windows": {
"PYTHONPATH" : "C:\\path\\to\\your\\project\\Library\\PackageCache\\com.unity.scripting.python@2.0.0-preview.6\\Python\\site-packages",
},
"python.pythonPath": "C:\\Python27\\python.exe",
"[python]": {
},
This worked fine for me, at least, your milage may vary.
It would be really nice if Unity could integrate its own python, not only to make things easier for end-users who don’t want to have to deal with python, but also to keep away the extra windows and what not similar to Houdini, or well, any other DCC out there really that has python capability, which is pretty much all of them.
The biggest issue out of the box seems to be that each time I try and run a python application (at least the GUI example that I copied and modified), it creates a new OnUpdate and doesn’t seem to release them when closing it, so they just keep adding up and kill any sort of editor performance when trying to iterate, so you have to keep restarting Unity, which pretty much defeats the purpose of having python as a separate process anyways.
All in all though, this is a great step in the right direction for Unity, really happy to see it.
Thanks,
-MH