Hello, i just need a simple way to launch a python interpreter (which will run some simple I/O functions in the background) at the start of my game. Cannot find this anywhere on the internets.
I'm using it grab some sensor values to pass to unity, but its not really a smooth operation to have to manually start the interpreter from a terminal window.
Thanks!
What are your "sensor values"? Are you running Unity with some interesting custom hardware? (just curious ...)
For more information (there are lots of options), see the MSDN docs. You can redirect and capture standard output and standard error, pass in more options, wait for the process to complete, etc.
Note that if this is for other people to use you will need to ensure python is available on their system -- this will work best in the Unity editor environment, or should be ok from a standalone build but I would be very surprised if it worked from a web player (and an iPhone is right out! ;-)
It ought to work cross-platform, but I'm on Windows, so no guarantees. Try getting it to launch something simple you know should work -- I tested by launching notepad.exe, the little text editor that comes with Windows.
P.S. Once you know you can launch an external process, look at the MSDN docs to see how to capture standard output, then you can send it to Unity's Debug.Log to see what's happening.
What are your "sensor values"? Are you running Unity with some interesting custom hardware? (just curious ...)
– yoyo