- Home /
Open a external program
Im doing a unity project.I want to open a external program while running the unity project. I've searched and I can open a external program. But I got a problem is about the path. This is my path "C:/Users/xiongzhou/Documents/MP_SIP_Unity_Project/Assets/mjpeg-player/sample2.html", but when I use another computer to run this project , it just cannot open already. How can I run a program in the project folder its own for any computer.
Answer by save · Jul 04, 2011 at 09:44 AM
You can use:
Application.OpenURL ((Application.dataPath) + "/mjpeg-player/sample2.html");
Where, if you copy the mjpeg-player-folder to your builds data-folder, it'll also work at runtime.
You can also use (for other filetypes - to more fit the answer to the topic):
System.Diagnostics.Process.Start(Application.dataPath + "/theApplication.exe");
//or directly to open external programs:
System.Diagnostics.Process.Start("notepad.exe");
This will as expected not work for the Web Player due to security reasons.
Answer by Dinkelborg · Oct 03, 2013 at 08:48 PM
How does one terminate this process on Application quit? ... The starting works, tho my external "client" does not have a function to quit... Do I have to create one in my client and send a message over the server of is Unity actually capable of closing the process it opened?
Answer by Flashmangagames · May 30, 2014 at 01:30 PM
Simply put the external application in the assets folder to your unity project
@Flashmangagames Can you explain how should be it. I didn't understand what did you mean. Where exactly we need to put the program (.exe or .bat for example)? And how to call the application... Thanks!
Answer by alejandro0000 · Oct 13, 2018 at 04:58 PM
Hi, I want to be able in my program to select de path of the other exe file and see the application image. How should I do that? Is that possible? Can you help me?
Your answer
Follow this Question
Related Questions
Directory.GetFiles() , not sure if bug or noob inside 0 Answers
Problem with path in FileStream 2 Answers
[Mac Build] changes path letters following dot to underscore 0 Answers
Relative asset paths 1 Answer
Make a drunk character swerve and loop on the way to a waypoint but still make it eventually. 2 Answers