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
1
Question by Doodayer · Jun 30, 2015 at 12:17 PM · openexternalprogram

Open External Program - Unity 5

I already know how to run an external program within unity using Code (CSharp): System.Diagnostics.Process.Start("C:/users/myname/desktop/fceux/fceux.exe"); However, what i want to do is keep fceux/fceux.exe within the games files itself, that way when I build it, everything comes with the game (in this case, my application).

From what I read online, i would need to keep fceux/fceux.exe in the same directory as the launcher, however with Unity 5 I can't seem to find where that's at in my project folder. Where do I need to put the folder?

Comment
Add comment · Show 1
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 Tomer-Barkan · Jul 02, 2015 at 01:08 PM 0
Share

Can't you just put the fceux directory inside the directory that contains your executable (or your project root in editor), then just run it as a relative path?

System.Diagnostics.Process.Start("./fceux/fceux.exe");

On windows you might want to try ".\\fceux\\fceux.exe"

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by zach-r-d · Jul 01, 2015 at 10:55 AM

Put the file in a folder called StreamingAssets. The file will then be included in the data files that come along with the launcher. The path of the executable at runtime can be determined like so:

 string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "fceux.exe");


Comment
Add comment · Show 10 · 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 Doodayer · Jul 02, 2015 at 12:41 AM 0
Share

I added it to the games files, and my files go: game -> Assets, Library, ProjectSettings, Strea$$anonymous$$gAssets, Temp, etc. and then from there Strea$$anonymous$$gAssets -> fceux -> fceux.exe, other misc. files related to fceux

yet i still get the error that it can't find it? Here's the code i'm using:

 public void PlayGame() {
         string filePath = System.IO.Path.Combine(Application.strea$$anonymous$$gAssetsPath, "/fceux/fceux.exe");
         System.Diagnostics.Process.Start(filePath);
     }

avatar image zach-r-d · Jul 02, 2015 at 04:18 AM 0
Share

Oh, the documentation doesn't make this totally clear, but Strea$$anonymous$$gAssets should be inside the Assets folder. You'll know it's working properly if any assets placed inside of it are not imported by Unity (e.g. an image file is just treated like a file rather than a texture).

avatar image Doodayer · Jul 02, 2015 at 04:22 AM 0
Share

see, i thought about that and put it in the Assets as well, and it still didn't work.

avatar image zach-r-d · Jul 02, 2015 at 04:34 AM 0
Share

Can you confirm that dragging an image file into the Strea$$anonymous$$gAssets folder is not imported? When you say it "still didn't work", is there an error? Does nothing happen?

avatar image Doodayer · Jul 03, 2015 at 02:31 AM 1
Share

Alright that worked great thanks!

Show more comments

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Script Editor Highlighting? 1 Answer

run external program within unity is possible? 0 Answers

Open script editor IDE to a particular line/function from EditorScript? 4 Answers

Open the door slowly, pressing a key on the keyboard 1 Answer

Can I open unity pro projects with unity free? 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