Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 HPVal · Aug 09, 2015 at 04:13 PM · build-errorspeechprocessexeexternal-application

In build - Process cannot find file

Hello.

I'm making a game with Voice Recognition and I made it work alright in the editor. In one of the scripts in the Start function, I call a Process so it can start an external .exe. This .exe is needed in order for the speech recognition to work. I have this .exe in the Assets folder.

But when I make a build of the game I get this error in the output_log.txt file when I start the game.

Win32Exception: The system cannot find the file specified.

at System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00095] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs:969

at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x0008e] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs:1198

at System.Diagnostics.Process.Start () [0x0002c] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs:1210

at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()

at UDP_RecoServer.Start () [0x00030] in C:\Users\Valentina\VoiceTest\Assets\Scripts\UDP_RecoServer.cs:32 (Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/System/System.Diagnostics/Process.cs Line: 969)

Setting up 1 worker threads for Enlighten. Thread -> id: 14b8 -> priority: 1

So the question is how can I run that .exe in the build too? Is there another way I can reference to it?

Thank you.

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
0

Answer by hardcodednumber · Aug 10, 2015 at 04:04 PM

I think the best approach is to remove the EXE outside of your project. I would do a relative path from the Unity exe to the voice Recognition EXE.

For example,

(Path to the UnityGame.exe)//..bin//VoiceRecognition.Exe

I would also make sure this persist when you make an installer for your game!

Comment
Add comment · Show 6 · 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 HPVal · Aug 10, 2015 at 04:30 PM 0
Share

Hmm, but the (Path to the UnityGame.exe) could be anything right? Let's say I set it to Desktop. If a user gets the game on their PC somewhere other than Desktop, how is my code going to know the path to my game? If I'm understanding correctly of course...could you give an example?

avatar image HPVal · Aug 10, 2015 at 04:52 PM 0
Share

Ok I figured it out! You were right! I wrote this in my code:

 myProcess.StartInfo.FileName = Application.dataPath + "/Server/RecoServeurX64.exe";
         

Application.dataPath stands for the game.exe folder that Unity builds, and the rest is the voice recognition folder which I just copied into the game.exe folder after I built it.

I have another problem though. This "RecoServeurX64.exe", once it starts it searches for a .txt file so it can read phrases and words for the voice recognition. This .txt is supposed to be in the same folder as the "RecoServeurX64.exe" for it to work. And it is. Although when I start the game.exe I can see the "RecoServeurX64.exe" opening fine in the task manager and then after a few seconds it closes which means it didn't find the .txt file. Any idea about that?

avatar image hardcodednumber · Aug 10, 2015 at 05:11 PM 0
Share

Does the path to the .txt file need to be absolute or relative. I would print the string arguments and see what the problem is.

On another note, since your game is depended on this process. I would use the Process class to make sure the process is at all running. For example, if the user closes RecoSereurX64.exe on accident. If they do, I'd fire off an event and stop your game or restart the exe.

avatar image HPVal · Aug 10, 2015 at 06:22 PM 0
Share

I'm not sure if it has to be absolute, I think it might need to be. Here's what's going on in the pic: alt text

I managed to print screen before it closed. The RecoSereurX64.exe, which is in the game executable folder, seems to be looking for the .txt file on the Desktop. Why is that? It should be looking into the same folder it is placed. When I place the .txt file on the Desktop the game seems to works well.

Yes that's a precaution I'll take too :)

EDIT: I got this written in my code so shouldn't it be looking in the correct folder rather than the Desktop?

 myProcess.StartInfo.FileName = Application.dataPath + "/Server/RecoServeurX64.exe";
 myProcess.StartInfo.Arguments = Application.dataPath + "/Server/grammar.txt";
 //myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
 myProcess.Start();
 

untitled.jpg (56.8 kB)
avatar image hardcodednumber · Aug 11, 2015 at 05:11 PM 0
Share

Have you tried to make sure that the file path is valid? Open a explorer window and copy and past the path in there. It should open up to the file in notepad (or whatever your default program is). If it doesn't then the path isn't valid. Is their documentation on the program?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

System.Diagnostics.Process.Kill() doesn't work 1 Answer

How can I stop the variable values reverting to its default values after being built? 1 Answer

Car Tutorial Raycast Issue since Upgrade Unity 4, Build fails editor works 1 Answer

How do I run an exe from unity without a window poping up. 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