Skip to content

Instantly share code, notes, and snippets.

@glitchersgames
Created February 19, 2019 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glitchersgames/3854cbf5837e24e37da0ad3a019be268 to your computer and use it in GitHub Desktop.
Save glitchersgames/3854cbf5837e24e37da0ad3a019be268 to your computer and use it in GitHub Desktop.
// 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