Exemplo n.º 1
0
        public int?TryGetUnityProcessId()
        {
            var model = myBackendUnityHost.BackendUnityModel.Value;

            if (model != null)
            {
                if (model.UnityApplicationData.HasValue())
                {
                    return(model.UnityApplicationData.Value.UnityProcessId);
                }
            }
            // no protocol connection - try to fallback to EditorInstance.json
            var processIdString = EditorInstanceJson.TryGetValue(EditorInstanceJsonPath, "process_id");

            if (processIdString == null)
            {
                return(null);
            }

            // Check exists of process if it was killed by manual and EditorInstance.json wasn't deleted
            var pid = Convert.ToInt32(processIdString);

            return(PlatformUtil.ProcessExists(pid) ? pid : (int?)null);
        }