diff --git a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab index 697a9983..b80a71f1 100644 --- a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab +++ b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab @@ -4824,7 +4824,9 @@ PrefabInstance: m_Modifications: - target: {fileID: 1917941435178448969, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_Text - value: Connect + value: 'Connect + +' objectReference: {fileID: 0} - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size @@ -4904,7 +4906,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_SizeDelta.x - value: 180.69582 + value: 200.6693 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_SizeDelta.y @@ -4940,7 +4942,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchoredPosition.x - value: 1037.5765 + value: 1046.1573 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchoredPosition.y @@ -4995,7 +4997,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 - m_MinWidth: 180 + m_MinWidth: 200 m_MinHeight: -1 m_PreferredWidth: -1 m_PreferredHeight: -1 diff --git a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs index 31ce3393..2dfbec9d 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs @@ -7,7 +7,6 @@ using TMPro; using UnityEngine; using UnityEngine.Events; -using UnityEngine.Serialization; using UnityEngine.UI; // using Process = KS.Diagnostics.Process; @@ -75,6 +74,11 @@ private void OnEnable() UpdateConnectionPanel(); } + private void OnDestroy() + { + KillEphysLinkProcess(); + } + #endregion #region UI Functions @@ -171,8 +175,8 @@ public void OnLaunchEphysLinkPressed() _ => "sensapex" }; - // Make args string. - var args = $"-t {manipulatorTypeString}"; + // Make args string (ignore updates, select type). + var args = $"-i -t {manipulatorTypeString}"; // Add Pathfinder port if selected. if (_manipulatorTypeDropdown.value == 2) @@ -195,6 +199,7 @@ public void OnLaunchEphysLinkPressed() _manipulatorTypeDropdown.interactable = false; _launchEphysLinkButton.interactable = false; _connectButton.SetActive(true); + _connectButtonText.text = "Connecting..."; // Attempt to connect to server. var attempts = 0; @@ -269,13 +274,7 @@ public void OnConnectDisconnectPressed() CommunicationManager.Instance.DisconnectFromServer(() => { - // Kill internally started Ephys Link process - if (_ephysLinkProcess != null) - { - _ephysLinkProcess.Kill(true); - _ephysLinkProcess.Dispose(); - } - + KillEphysLinkProcess(); UpdateConnectionPanel(); }); }; @@ -352,6 +351,14 @@ private void UpdateConnectionPanel() UpdateManipulatorPanels(); } + private void KillEphysLinkProcess() + { + if (_ephysLinkProcess == null) return; + _ephysLinkProcess.Kill(true); + _ephysLinkProcess.Dispose(); + _ephysLinkProcess = null; + } + #endregion } } \ No newline at end of file