Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 JimNero_009 · Dec 06, 2015 at 02:49 PM · externallinkingexternal-application

Execute External Program

Hello!

So I have a pretty general question, mostly related to my lack of concrete coding knowledge. Basically, I'm currently working on a physics program which can generate predictions for the LHC. The problem one always gets with these sorts of programs is that nice user interfaces just basically don't exist.

What I would like to do is use Unity to have a link between the user and the program. At the very least, I would like to be able to call my physics program from within Unity. If I can do this, then I can use Unity to get the information from the user regarding the input paramters, execute the program and (possibly) do something fancy while the program runs.

The question is - how can I execute an external program from within Unity?

Cheers!

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by tanoshimi · Dec 06, 2015 at 03:25 PM

Use Process.Start from the System.Diagnostics namespace. Something like this:

 using System.Diagnostics;
 ....
 void LoadYourPhysicsProgram() {
   ProcessStartInfo startInfo = new ProcessStartInfo();
   startInfo.FileName = "PHYSICSPROGRAM.EXE";
   StartInfo.Arguments = "Extra Arguments to Pass to the Program";
   Process.Start(startInfo);
 }
Comment
Add comment · Show 1 · 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 JimNero_009 · Dec 07, 2015 at 12:44 PM 0
Share

Hi,

Thanks for the answer. I've tried doing this just now but doesn't seem to be doing anything, but also get no compiler errors. The program in question is one that is usually run in the ter$$anonymous$$al, so perhaps getting Unity to open a ter$$anonymous$$al and run the program in that might do it?

avatar image
0

Answer by william-hoopes-wb · Aug 03, 2017 at 04:56 PM

A little late to this party, but for others coming across this, what I've found that works best is to write a bat/sh file to disk, and run that instead. When using Process.Start(), you don't get the context you would have when running from a shell (ie PATH variables, etc). Using Process expects you to fill that in (at least from Unity). By writing a bat/sh script to disk, and then running it, you're taking advantage of the system providing that context for you.

Comment
Add comment · 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
0

Answer by markv12 · Jan 16, 2020 at 01:42 AM

https://www.youtube.com/watch?v=YkXWySYF5dE

Comment
Add comment · 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

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

How to open unity solution with some specific inputs (command line or from website javascript) ? 1 Answer

How can I add an Input Axis from a script, input coming from an external program? 0 Answers

Problems accessing a function 1 Answer

OSX: How to link GameKit framework? 0 Answers

External build in order to have have different textures runtime 1 Answer


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