浏览代码

Attempt to Kill process when unity closes

/pyrception-integration
leopoldo-zugasti 3 年前
当前提交
286baf56
共有 1 个文件被更改,包括 23 次插入12 次删除
  1. 35
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs

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


[MenuItem("Window/Pyrception/Run")]
static void RunPyrception()
{
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;
}
KillProcess();
string path = Path.GetFullPath(Application.dataPath.Replace("/Assets", ""));
#if UNITY_EDITOR_WIN

#endif
if (ExitCode != 0) {
EditorUtility.ClearProgressBar();
return;
}

}
EditorUtility.ClearProgressBar();
}
void OnDestroy()
{
KillProcess();
}
private static void KillProcess()
{
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;
}
}
/// <summary>

正在加载...
取消
保存