- Home /
EXE run from unity does not work as it should.
I am attempting to run my own custom .exe from unity which I have managed to do. The .exe runs perfectly when I open it manually by double clicking, but from Unity it just opens then does not work at all.
For context, the .exe is a very basic script which reads a text file and then creates another one. When run from Unity the executable window says that this file does not exist, when I know it does, and then immediately closes.
I have tried running this .exe with these methods:
Application.OpenURL(path + "Search.exe");
and
Process.Start(path + "Search.exe");
and I have tried this with the .exe and the text file being in different places (Application.dataPath, Application.persistentDataPath, and also an external folder on my computer).
It seems no matter what I do the .exe just doesn't run the same from Unity as when I click on it.
Answer by mike175 · Jul 26, 2020 at 01:29 PM
For anyone wondering, I found the solution was to set the Process' directory to the path of the folder the .exe was in.
Specifically, this was the code I use:
Process process = new Process();
process.StartInfo.FileName = path + "Search.exe";
process.StartInfo.WorkingDirectory = path;
process.Start();
Your answer
Follow this Question
Related Questions
How to get .exe file to run through script? 1 Answer
iphone: this executable was signed with invalid entitlements 2 Answers
How to generate a Linux ARM build of Unity application? 1 Answer
FOV script does not change camera FOV on executable, but it does in the unity playtest. 0 Answers
what are the different ways of creating an exe from a unity game? 2 Answers