Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by netherboss123 · Feb 06, 2015 at 02:30 AM · external-application

opening an external .exe file from a game

hi. im trying to make a launcher for all of my games because i have alot of them. i have tried to use this code:

 #pragma strict
 
 function OnMouseDown ()
 {
 System.Diagnostics.Process.Start(Application.dataPath + "Desktop");
  //or directly to open external programs:
  System.Diagnostics.Process.Start("RacingPlanet2Launch.exe");
 }
 

but it doesnt work. please could somebody help me fix it? the error i get with it is:

Win32Exception: The system cannot find the file specified.

System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) System.Diagnostics.Process.Start (System.String fileName) Open Racing Planet 2.OnMouseDown () (at Assets/Open Racing Planet 2.js:5) UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Kriogenic · Feb 06, 2015 at 06:04 AM

The issue is exactly as it says, it can not find the application you wish to open.

if RacingPlanet2Launch.exe is in the same directory as the launcher the bottom line should work.

the error is coming from the line above where you open nothing, it seems you are trying to browse to your desktop which is incorrect. Remove that line completely.

 function OnMouseDown ()
 {
 //will open if exe is in same directory as launchers exe file.
 System.Diagnostics.Process.Start("RacingPlanet2Launch.exe");
 
 //Logs the dataPath so you can see where your applications should be
 Debug.Log(Application.dataPath);
 
 //will open from the applications dataPath directory
 System.Diagnostics.Process.Start(Application.dataPath + "/RacingPlanet2Launch.exe");
 }
Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image netherboss123 · Feb 06, 2015 at 11:38 AM 0
Share

when i put the exe file in the assets folder and it gets a weird error

avatar image vishal netherboss123 · Dec 12, 2018 at 12:34 PM 0
Share

Not only exe file, you have to move complete package (i.e all supporting files) and it would be great if you create one sub directory.

avatar image Kriogenic · Feb 06, 2015 at 12:55 PM 0
Share

probably because you are moving the application .exe from where the game is installed when you should be making a shortcut to that exe file and then loading that with your script.

another note is that you dont add it to unity at all. it is purely called by its directory and should not be imported into your assets folder within unity.

avatar image Sonic_Neptune Kriogenic · Jul 11, 2018 at 02:51 PM 0
Share

Right unless you want to load it from inside the actual Unity project.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

make a button in unity to open an external windows application. 2 Answers

communicate between Unity and a Windows exe? -1 Answers

Receiving Character Controller Input from Other Program 0 Answers

After starting an external program, how can I make my Unity program wait until the external program has ended? 0 Answers

Sending info from unity C# to Matlab? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges