title: Reading out Serial Port "COM3" in Unity. Connection establishing succesful, but the DataReceiveHandler is not called
body: <p>I need to scan QR Code (via Scanner not a Camera). The scanner is sending the data over the Serial Port "COM3" and I need it as a string in Unity. So setting up the connection works fine and without any errors or exceptions, but the system is not registering the my event at the SerialDataReceivedEventHandler. (See code: DataReceiveHandler and everything in it seems nerver to be called)</p>
  
  <p>I use the following Settings to open the Port:</p>
  
  <p>PortName is "COM3"
  BaudRate is 19200
  PortParity is None
  PortBits is 8
  PortStopBits is One</p>
  
  <p>As I said, the port opens correctly. I get no errors or exceptions.
  Maybe you see something that I don't see.
  Thank you!</p>
  
  <pre><code>private void Start()
  {
      Init();
  }
  
  private void Update()
  {
      PortIsOpen = SP.IsOpen;
  }
  
  private void EstablishPortConnection()
  {
      try
      {
          if(SP != null)
          {
              SP.Close();
              SP.Dispose();
              SP = null;
          }
  
          if(SP == null)
          {
              SP = new SerialPort(PortName, BaudRate, PortParity, PortBits, PortStopBits);
              SP.RtsEnable = true;
              SP.DataReceived += new        SerialDataReceivedEventHandler(DataRecievedHandler);
              SP.Open();
          }
      }
      catch(Exception _ex)
      {
          Debug.Log("Error while establishing connection! Error: " + _ex);
      }
  }
  
  private void DataRecievedHandler(object _sender,   SerialDataReceivedEventArgs _e)
  {
      Debug.Log("DataReceived");
      try
      {
          SerialPort tmpsp = (SerialPort)_sender;
          Debug.Log(tmpsp.ReadLine());
          Message = tmpsp.ReadLine();
      }
      catch(Exception _ex)
      {
          Debug.Log("Error during message receiving. Error: " + _ex);
      }
  }
  
  public void Init()
  {
      Message = "";
      EstablishPortConnection();
  }
  </code></pre>