- Home /
make a button in unity to open an external windows application.
Hello
I want to make a button in some area in my game. when the player find it and press, an external application with exe extension should be run. can i do this with unity. if i can how ??? thanks
Answer by fherbst · Jul 07, 2010 at 12:34 PM
As addition to SpikeX answer and your comment:
You can use
// Goes in OnGUI():
if(GUI.Button(new Rect(15, 15, 95, 35), "Open my Application"))
{
// Application.dataPath will return your projects' Data folder path
System.Diagnostics.Process.Start(Application.dataPath + "/myApplication.exe");
}
You will have to copy your "myApplication.exe" to your Data folder whenever you build your game (or write a postProcess script that does that for you, but that would be probably overpowered).
Answer by qJake · Jul 07, 2010 at 04:21 AM
It's pretty easy (you can't do this with the web player):
// Goes in OnGUI():
if(GUI.Button(new Rect(15, 15, 95, 35), "Open Notepad"))
{
System.Diagnostics.Process.Start("notepad.exe");
}
Thanks but if my have ma application named for exemple appl1.exe and placed in the D:/application/apl1.exe how can i do it and expor it with the build of the game. thanks
What felix said. Include it in your data directory and use his code.
Your answer
![](https://koobas.hobune.stream/wayback/20220613064027im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
In build - Process cannot find file 1 Answer
[SOLVED] Unable To Import Fonts? Unable to open assets/fonts check external settings 2 Answers
Integrate Unity inside a QT Application 0 Answers
How to launch another program when using or interacting with an object? 1 Answer
Embed and communicate with Unity inside another app 2 Answers