I want to develop a Unity application that communicates with a Python script via socket to exchange information. However, I don’t want to run Unity and the Python script separately. Is there a way to package everything into a single executable, ensuring that the Python script runs alongside the Unity application? How can I achieve this?
I was thinking of doing something via the terminal, but I’m not sure how to proceed. I’d like some ideas on possible ways to make this work in my case.
I want to develop a Unity application that communicates with a Python script via socket to exchange information. However, I don’t want to run Unity and the Python script separately. Is there a way to package everything into a single executable, ensuring that the Python script runs alongside the Unity application? How can I achieve this?
I was thinking of doing something via the terminal, but I’m not sure how to proceed. I’d like some ideas on possible ways to make this work in my case.
Share Improve this question asked Mar 23 at 18:45 Mário SantanaMário Santana 11 bronze badge 9 | Show 4 more comments1 Answer
Reset to default 0If this is for a windows build I think there are mainly three options
Have your users install python as dependency
Probably not really desirable as it requires additional steps by your users and might of course introduce hickups
Portable Python
You could give it a shot and simply pack WinPython (a fully portable python) into your project and then as mentioned run a Process
using that library to then run your python server script.
This depends a bit on your python requirements. There is a minimal version and also a very huge "complete" version - but nothing custom inbetween.
Compile to Exe
Similar to above but alternatively you could also use a tool like e.g. Py2Exe and beforehand already compile your python server script into an .exe
file. You can then again simply pack it into your project and run via Process
from within your c#
code.
Process
? – derHugo Commented Mar 23 at 18:49