Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. // Tested only on Windows
  2. // Assumes builds are in the project folder (e.g. your-game/Builds/Build.exe)
  3.  
  4. using System;
  5. using System.IO;
  6. using System.Diagnostics;
  7.  
  8. public static class BuildRunning
  9. {
  10. public bool IsBuildRunning()
  11. {
  12. string projectDirectory = Directory.GetParent(Application.dataPath).Name;
  13.  
  14. foreach (Process p in Process.GetProcesses())
  15. {
  16. string fileName = Path.GetFullPath(p.MainModule.FileName);
  17.  
  18. if (fileName.Contains(projectDirectory))
  19. {
  20. return true;
  21. }
  22. }
  23.  
  24. return false;
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement