Created
February 19, 2019 09:43
-
-
Save glitchersgames/3854cbf5837e24e37da0ad3a019be268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tested only on Windows | |
// Assumes builds are in the project folder (e.g. your-game/Builds/Build.exe) | |
using System; | |
using System.IO; | |
using System.Diagnostics; | |
public static class BuildRunning | |
{ | |
public bool IsBuildRunning() | |
{ | |
string projectDirectory = Directory.GetParent(Application.dataPath).Name; | |
foreach (Process p in Process.GetProcesses()) | |
{ | |
string fileName = Path.GetFullPath(p.MainModule.FileName); | |
if (fileName.Contains(projectDirectory)) | |
{ | |
return true; | |
} | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment