private void OnRobotDebugListValueChanged(int newIndex) { if (_oldDebugRobotSelection != null) { _oldDebugRobotSelection.UnsubscribeToRobotLogsUpdate(OnReceivedRobotLog); } string selectedRobot = _robotDebugSelectRobot.options[newIndex].text; ROSController robot = RobotMasterController.Instance.GetRosControllerFromName(selectedRobot); if (robot != null) { InitialiseRobotDebugPanel(robot.GetRobotLogs()); robot.SubscribeToRobotLogsUpdate(OnReceivedRobotLog); _oldDebugRobotSelection = robot; } }
private void OnSelectedRobotValueChanged(int newIndex) { ROSController selectedRobot = RobotMasterController.Instance.GetRosControllerFromName(_selectRobot.options[newIndex].text); UpdateUI(selectedRobot); RobotMasterController.Instance.SelectRobot(selectedRobot); if (CurrentUIState != UIState.RobotDebug) { if (_oldSelectRobotSelection != null) { _oldSelectRobotSelection.UnsubscribeToRobotLogsUpdate(OnReceivedRobotLog); } if (selectedRobot != null) { selectedRobot.SubscribeToRobotLogsUpdate(OnReceivedRobotLog); } } _oldSelectRobotSelection = selectedRobot; }