浏览代码

Make sure that only one instance exists

/pyrception-integration
leopoldo-zugasti 4 年前
当前提交
39f7b49c
共有 1 个文件被更改,包括 15 次插入3 次删除
  1. 18
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs

18
com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs


using UnityEngine.Perception.GroundTruth;
public class PyrceptionInstaller : EditorWindow
{
private static Process currentProcess = null;
{
private static int currentProcessId = -1;
/// <summary>
/// Runs pyrception instance in default browser
/// </summary>

if (currentProcessId != -1)
{
UnityEngine.Debug.Log($"Process is alive - {currentProcessId}");
Process proc = Process.GetProcessById(currentProcessId+1);
if(proc == null)
{
UnityEngine.Debug.Log("Could not find process");
}
proc.Kill();
currentProcessId = -1;
}
string path = Path.GetFullPath(Application.dataPath.Replace("/Assets", ""));
#if UNITY_EDITOR_WIN

if (!waitForExit)
{
currentProcess = cmd;
currentProcessId = cmd.Id;
return "";
}

正在加载...
取消
保存