Hello everyone,
I’m trying to find a running process from within Unity. So let’s say I have a process running called “1.exe”… Now I will use the following code.
void DetectProcess() {
Process[] running = Process.GetProcesses();
foreach(Process process in running) {
if(process.ProcessName == "1") {
print("found process");
}
}
}
This will give the following error:
InvalidOperationException: Process has exited, so the requested information is not available.
System.Diagnostics.Process.get_ProcessName ()
I’ve read somewhere that this was a bug, but that was a pretty old post and thought it would’ve been solved by now.
So, am I doing something wrong or is it still a bug and does anyone have a working solution?
All I need to do is to check whether process 1.exe is still running or not.